diff --git a/lib/chanko/railtie.rb b/lib/chanko/railtie.rb index c5c804f..663206d 100644 --- a/lib/chanko/railtie.rb +++ b/lib/chanko/railtie.rb @@ -7,11 +7,6 @@ class Railtie < Rails::Railtie ActiveSupport.on_load :action_controller do ::ActionController::Base.send(:include, Controller, Invoker, UnitProxyProvider) end - ActiveSupport.on_load :active_record do - ::ActiveRecord::Base.send(:include, UnitProxyProvider) - ::ActiveRecord::Relation.send(:include, UnitProxyProvider) - ::ActiveRecord::Associations::CollectionAssociation.send(:include, UnitProxyProvider) - end end diff --git a/lib/chanko/unit/extender.rb b/lib/chanko/unit/extender.rb index 753558a..20f5945 100644 --- a/lib/chanko/unit/extender.rb +++ b/lib/chanko/unit/extender.rb @@ -1,4 +1,3 @@ -require "chanko/unit/extender/active_record_class_methods" require "chanko/unit/extender/extension" module Chanko diff --git a/lib/chanko/unit/extender/active_record_class_methods.rb b/lib/chanko/unit/extender/active_record_class_methods.rb deleted file mode 100644 index 929fff3..0000000 --- a/lib/chanko/unit/extender/active_record_class_methods.rb +++ /dev/null @@ -1,57 +0,0 @@ -module Chanko - module Unit - class Extender - module ActiveRecordClassMethods - delegate( - :apply_modules, - :arel, - :array_of_strings?, - :build_arel, - :build_joins, - :build_select, - :build_where, - :create_with, - :custom_join_sql, - :eager_load, - :extending, - :from, - :group, - :having, - :includes, - :joins, - :limit, - :lock, - :offset, - :order, - :preload, - :readonly, - :reorder, - :reverse_order, - :reverse_sql_order, - :scope, - :select, - :where, - :to => :@mod - ) - - %w[belongs_to has_many has_one].each do |method_name| - class_eval <<-EOS - def #{method_name}(*args, &block) - label = args.shift.to_s - name = @prefix + label - options = args.extract_options! - options = options.reverse_merge(:class_name => label.singularize.camelize) - args << options - @mod.#{method_name}(name.to_sym, *args, &block) - end - EOS - end - - def scope(*args, &block) - name = @prefix + args.shift.to_s - @mod.scope(name, *args) - end - end - end - end -end diff --git a/lib/chanko/unit/extender/extension.rb b/lib/chanko/unit/extender/extension.rb index a6b89ef..60601a2 100644 --- a/lib/chanko/unit/extender/extension.rb +++ b/lib/chanko/unit/extender/extension.rb @@ -2,8 +2,6 @@ module Chanko module Unit class Extender class Extension < Module - include ActiveRecordClassMethods - def initialize(mod, prefix = nil, &block) @mod = mod @prefix = prefix