aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb18
1 files changed, 2 insertions, 16 deletions
diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
index cd866d2cdd..cc6549f3ae 100644
--- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
+++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
@@ -68,13 +68,9 @@ module ActiveRecord
self
end
-
+
alias :concat_with_attributes :push_with_attributes
- def size
- @reflection.options[:uniq] ? count_records : super
- end
-
protected
def method_missing(method, *args, &block)
if @target.respond_to?(method) || (!@reflection.klass.respond_to?(method) && Class.respond_to?(method))
@@ -85,17 +81,7 @@ module ActiveRecord
end
end
end
-
- def find_target
- if @reflection.options[:finder_sql]
- records = @reflection.klass.find_by_sql(@finder_sql)
- else
- records = find(:all)
- end
-
- @reflection.options[:uniq] ? uniq(records) : records
- end
-
+
def count_records
load_target.size
end