railtie to rails

This commit is contained in:
ZengTao 2016-06-22 11:52:42 +08:00
parent c40b9f0fcc
commit 3164e5a59b
2 changed files with 17 additions and 0 deletions

View File

@ -4,4 +4,6 @@ module ActsAsFollowable
autoload :Followable, 'acts_as_followable/followable'
# autoload :Follower, 'acts_as_followable/follower'
autoload :FollowExt, 'acts_as_followable/follow_ext'
require 'acts_as_followable/railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
end

View File

@ -0,0 +1,15 @@
require 'acts_as_follower'
require 'rails'
module ActsAsFollower
class Railtie < Rails::Railtie
initializer "acts_as_followable.active_record" do |app|
ActiveSupport.on_load :active_record do
# include ActsAsFollowable::Follower
include ActsAsFollowable::Followable
end
end
end
end