Sha256: 2b0767a2c6ce673bc7ebb8edcd5f1676d2c56ff0ebcaa61f28df62bf4d747a65
Contents?: true
Size: 1.86 KB
Versions: 14
Compression:
Stored size: 1.86 KB
Contents
module EffectiveResources class Engine < ::Rails::Engine engine_name 'effective_resources' config.autoload_paths += Dir["#{config.root}/lib/", "#{config.root}/app/controllers/concerns/effective/"] # Set up our default configuration options. initializer 'effective_resources.defaults', before: :load_config_initializers do |app| eval File.read("#{config.root}/config/effective_resources.rb") end # Register the acts_as_archived routes concern # resources :things, concerns: :acts_as_archived initializer 'effective_resources.routes_concern' do |app| ActionDispatch::Routing::Mapper.include(ActsAsArchived::RoutesConcern) end # Register the flash_messages concern so that it can be called in ActionController initializer 'effective_resources.action_controller' do |app| ActiveSupport.on_load :action_controller do include(Effective::FlashMessages) end end # Include acts_as_addressable concern and allow any ActiveRecord object to call it initializer 'effective_resources.active_record' do |app| ActiveSupport.on_load :active_record do ActiveRecord::Base.extend(ActsAsArchived::ActiveRecord) ActiveRecord::Base.extend(ActsAsTokened::ActiveRecord) ActiveRecord::Base.extend(ActsAsSlugged::ActiveRecord) ActiveRecord::Base.extend(ActsAsStatused::ActiveRecord) ActiveRecord::Base.extend(EffectiveResource::ActiveRecord) end end initializer 'effective_resources.cancancan' do |app| if defined?(CanCan::Ability) CanCan::Ability.module_eval do CRUD_ACTIONS = [:index, :new, :create, :edit, :update, :show, :destroy] def crud CRUD_ACTIONS end end CanCan::Ability.include(ActsAsArchived::CanCan) CanCan::Ability.include(ActsAsStatused::CanCan) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems