Permalink
Browse files

Remove unnecessary overloaded methods create, create! and create_reco…

…rd from HasAndBelongsToManyAssociation
  • Loading branch information...
1 parent 7f5fcc0 commit 9863d8a5f6576ab10df51230c0531cec8d4468f9 @jonleighton jonleighton committed with tenderlove Dec 17, 2010
Showing with 0 additions and 18 deletions.
  1. +0 −18 activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
@@ -2,14 +2,6 @@ module ActiveRecord
# = Active Record Has And Belongs To Many Association
module Associations
class HasAndBelongsToManyAssociation < AssociationCollection #:nodoc:
- def create(attributes = {})
- create_record(attributes) { |record| insert_record(record) }
- end
-
- def create!(attributes = {})
- create_record(attributes) { |record| insert_record(record, true) }
- end
-
def columns
@reflection.columns(@reflection.options[:join_table], "#{@reflection.options[:join_table]} Columns")
end
@@ -109,16 +101,6 @@ def finding_with_ambiguous_select?(select_clause)
end
private
- def create_record(attributes, &block)
- # Can't use Base.create because the foreign key may be a protected attribute.
- ensure_owner_is_persisted!
- if attributes.is_a?(Array)
- attributes.collect { |attr| create(attr) }
- else
- build_record(attributes, &block)
- end
- end
-
def record_timestamp_columns(record)
if record.record_timestamps
record.send(:all_timestamp_attributes).map { |x| x.to_s }

0 comments on commit 9863d8a

Please sign in to comment.