diff options
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb | 27 |
1 files changed, 5 insertions, 22 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 c8e216f072..2155ce8e30 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 @@ -5,7 +5,7 @@ module ActiveRecord super construct_sql end - + def build(attributes = {}) load_target record = @reflection.klass.new(attributes) @@ -27,7 +27,7 @@ module ActiveRecord def find_first load_target.first end - + def find(*args) options = Base.send(:extract_options_from_args!, args) @@ -66,24 +66,7 @@ module ActiveRecord args << options @reflection.klass.find(*args) end - end - - # Deprecated as of Rails 1.2. If your associations require attributes - # you should be using has_many :through - def push_with_attributes(record, join_attributes = {}) - raise_on_type_mismatch(record) - join_attributes.each { |key, value| record[key.to_s] = value } - - callback(:before_add, record) - insert_record(record) unless @owner.new_record? - @target << record - callback(:after_add, record) - - self end - deprecate :push_with_attributes => "consider using has_many :through instead" - - alias :concat_with_attributes :push_with_attributes protected def count_records @@ -121,10 +104,10 @@ module ActiveRecord @owner.connection.execute(sql) end - + return true end - + def delete_records(records) if sql = @reflection.options[:delete_sql] records.each { |record| @owner.connection.execute(interpolate_sql(sql, record)) } @@ -134,7 +117,7 @@ module ActiveRecord @owner.connection.execute(sql) end end - + def construct_sql interpolate_sql_options!(@reflection.options, :finder_sql) |