Sha256: 4d89f50346799e50c7cefc0e70abe6a0327e53b1d429d848817991e15e843899
Contents?: true
Size: 1.21 KB
Versions: 11
Compression:
Stored size: 1.21 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! # load all permits 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 path end end end end
Version data entries
11 entries across 11 versions & 1 rubygems