Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove unnecessary overloaded methods create, create! and create_reco…

…rd from HasAndBelongsToManyAssociation
  • Loading branch information...
commit 9863d8a5f6576ab10df51230c0531cec8d4468f9 1 parent 7f5fcc0
Jon Leighton jonleighton authored tenderlove committed
18 activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
View
@@ -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 }
Please sign in to comment.
Something went wrong with that request. Please try again.