Sha256: 2082f87bc600638b4fab44ae9362f3fb2068b2bddf68ab57c902120d31f155f6
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
module CanTango # Include helpers in the given scope to AC and AV. # "Borrowed" from devise def self.include_helpers(scope) # Seems like the order of initializers is important! ActiveRecord should go first! ActiveSupport.on_load(:active_record) do RailsAutoLoader.load_models! if CanTango.config.autoload.models? end ActiveSupport.on_load(:action_controller) do include scope::Rails::Helpers::ControllerHelper end ActiveSupport.on_load(:action_view) do include scope::Rails::Helpers::ViewHelper end end class RailsEngine < ::Rails::Engine initializer "cantango.helpers" do CanTango.include_helpers(CanTango) # load all models # this is needed in order to register all users and accounts with CanTango using the user/account macros! end config.to_prepare do # load all permits (development mode: EVERY request!) RailsAutoLoader.load_permits! if CanTango.config.autoload.permits? end end module RailsAutoLoader def self.load_models! load_files! :models end def self.load_permits! load_files! :permits end private def self.load_files! path Dir[::Rails.root + "app/#{path}/**/*.rb"].each do |path| require_dependency path end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cantango-0.9.3.2 | lib/cantango/rails/engine.rb |
cantango-0.8.9.5 | lib/cantango/rails/engine.rb |
cantango-0.8.9.4 | lib/cantango/rails/engine.rb |