Sha256: c6784d6608a17753ed22049dd572125b5575d428045efb7eb12d172bcb87aedf

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

module EffectiveRoles
  class Engine < ::Rails::Engine
    engine_name 'effective_roles'

    config.autoload_paths += Dir["#{config.root}/app/models/concerns", "#{config.root}/lib/"]

    # Include acts_as_addressable concern and allow any ActiveRecord object to call it
    initializer 'effective_roles.active_record' do |app|
      ActiveSupport.on_load :active_record do
        ActiveRecord::Base.extend(ActsAsRoleRestricted::ActiveRecord)
      end
    end

    # Register the log_page_views concern so that it can be called in ActionController or elsewhere
    initializer 'effective_logging.log_changes_action_controller' do |app|
      Rails.application.config.to_prepare do
        ActiveSupport.on_load :action_controller do
          require 'effective_roles/set_current_user'
          ActionController::Base.include(EffectiveRoles::SetCurrentUser::ActionController)
        end
      end
    end

    # Set up our default configuration options.
    initializer "effective_roles.defaults", :before => :load_config_initializers do |app|
      eval File.read("#{config.root}/config/effective_roles.rb")
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
effective_roles-2.0.3 lib/effective_roles/engine.rb
effective_roles-2.0.2 lib/effective_roles/engine.rb
effective_roles-2.0.1 lib/effective_roles/engine.rb
effective_roles-2.0.0 lib/effective_roles/engine.rb