Sha256: 8252c543007f0c669cf21d995e2f14a1a1e2deb9564ac5615d4cef8c65ea1a25

Contents?: true

Size: 644 Bytes

Versions: 2

Compression:

Stored size: 644 Bytes

Contents

require 'rails'

module ActsAsFollowable
  if defined? Rails::Railtie
    class Railtie < Rails::Railtie
      initializer "acts_as_followable.extend_action_controller_base" do |app|
        ActiveSupport.on_load(:active_record) do
          ActsAsFollowable::Railtie.insert
        end
      end
    end
  end

  class Railtie
    def self.insert
      require File.join(File.dirname(__FILE__), '..', '..', 'app', 'models', 'follow')
      begin
        require File.join(Rails.root||RAILS_ROOT, 'app', 'models', 'follow')
      rescue LoadError
      end
      ActiveRecord::Base.send(:include, ActsAsFollowable::Followable)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acts_as_followable-0.1.9 lib/acts_as_followable/railtie.rb
acts_as_followable-0.1.8 lib/acts_as_followable/railtie.rb