Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongoid support #28

Closed
wants to merge 16 commits into from
Closed

mongoid support #28

wants to merge 16 commits into from

Conversation

Fudoshiki
Copy link

module SirTrevorRails
class Engine < Rails::Engine

require 'redcarpet'

config.after_initialize do |app|
  app.config.paths.add 'app/sir_trevor_blocks', eager_load: true
end

initializer "sir_trevor_rails.load_app_instance_data" do |app|
  SirTrevorRails.setup do |config|
    config.app_root = app.root
  end
end

initializer "sir_trevor_rails.helpers" do
  ActiveSupport.on_load :action_view do
    ActionView::Base.send :include, SirTrevorRails::Helpers::ViewHelper
  end
end

initializer "sir_trevor_rails.view_resolver" do
  ActiveSupport.on_load :action_controller do
    ActionController::Base.send :append_view_path, SirTrevorRails::ViewResolver.new
  end
end

initializer "sir_trevor_rails.has_sir_trevor_content" do
  if defined?(Mongoid::Document)
    ActiveSupport.on_load :mongoid do
      Mongoid::Document::ClassMethods.send :include, SirTrevorRails::HasSirTrevorContent::SingletonMethods
    end
  else
    ActiveSupport.on_load :active_record do
      ActiveRecord::Base.send :include, SirTrevorRails::HasSirTrevorContent
    end
  end
end

end
end

@Fudoshiki Fudoshiki closed this Apr 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants