diff --git a/lib/acts_as_tenant.rb b/lib/acts_as_tenant.rb index cedfa5e..72e6e60 100644 --- a/lib/acts_as_tenant.rb +++ b/lib/acts_as_tenant.rb @@ -10,18 +10,13 @@ #$LOAD_PATH.shift -if defined?(ActiveRecord::Base) - ActiveRecord::Base.send(:include, ActsAsTenant::ModelExtensions) +ActiveSupport.on_load(:active_record) do |base| + base.include ActsAsTenant::ModelExtensions end -if defined?(ActionController::Base) - ActionController::Base.extend ActsAsTenant::ControllerExtensions -end - -if defined?(ActionController::API) - ActionController::API.extend ActsAsTenant::ControllerExtensions +ActiveSupport.on_load(:action_controller) do |base| + base.extend ActsAsTenant::ControllerExtensions end module ActsAsTenant end - \ No newline at end of file