Sha256: 4ddd40ed63347c0cf76f1ae2697c74cde0612fe57e3947b25ccd6dc9a47b034a

Contents?: true

Size: 673 Bytes

Versions: 1

Compression:

Stored size: 673 Bytes

Contents

require 'canard'
require 'rails'

module Canard
  class Railtie < Rails::Railtie
    
    initializer "canard.active_record" do |app|
      ActiveSupport.on_load :active_record do
        extend Canard::UserModel
        Canard.abilities_path ||= File.expand_path('abilities', Rails.root)
        Canard.find_abilities
      end
    end
    
    initializer "canard.abilities_reloading", :after => "action_dispatch.configure" do |app|
      if ActionDispatch::Reloader.respond_to?(:to_prepare)
        ActionDispatch::Reloader.to_prepare { Canard.find_abilities }
      else
        ActionDispatch::Reloader.before { Canard.find_abilities }
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
canard-0.2.7 lib/canard/railtie.rb