Skip to content

Commit

Permalink
Merge pull request composite-primary-keys#90 from fmmfonseca/insert_r…
Browse files Browse the repository at this point in the history
…ecord_fix

fix method signature mismatch with active_record
  • Loading branch information
cfis committed Mar 16, 2012
2 parents cd0fbb4 + 4a9cab1 commit 8cacba2
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
module ActiveRecord
module Associations
class HasAndBelongsToManyAssociation
def insert_record(record, validate = true)
return if record.new_record? && !record.save(:validate => validate)
def insert_record(record, validate = true, raise = false)
if record.new_record?
if raise
record.save!(:validate => validate)
else
return unless record.save(:validate => validate)
end
end

if options[:insert_sql]
owner.connection.insert(interpolate(options[:insert_sql], record))
Expand Down

0 comments on commit 8cacba2

Please sign in to comment.