Skip to content
Browse files

Merge pull request #10123 from wangjohn/added_bang_to_raise_nested_at…

…tributes_method

Added a bang to the raise_nested_attributes_record_not_found method
  • Loading branch information...
2 parents 4d8e234 + 3552760 commit 136e3a46e139e6105b0f18c29f7207bac7770be6 @carlosantoniodasilva carlosantoniodasilva committed Apr 6, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 activerecord/lib/active_record/nested_attributes.rb
View
6 activerecord/lib/active_record/nested_attributes.rb
@@ -362,7 +362,7 @@ def assign_nested_attributes_for_one_to_one_association(association_name, attrib
assign_to_or_mark_for_destruction(record, attributes, options[:allow_destroy]) unless call_reject_if(association_name, attributes)
elsif attributes['id'].present?
- raise_nested_attributes_record_not_found(association_name, attributes['id'])
+ raise_nested_attributes_record_not_found!(association_name, attributes['id'])
elsif !reject_new_record?(association_name, attributes)
method = "build_#{association_name}"
@@ -452,7 +452,7 @@ def assign_nested_attributes_for_collection_association(association_name, attrib
assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy])
end
else
- raise_nested_attributes_record_not_found(association_name, attributes['id'])
+ raise_nested_attributes_record_not_found!(association_name, attributes['id'])
end
end
end
@@ -514,7 +514,7 @@ def call_reject_if(association_name, attributes)
end
end
- def raise_nested_attributes_record_not_found(association_name, record_id)
+ def raise_nested_attributes_record_not_found!(association_name, record_id)
raise RecordNotFound, "Couldn't find #{self.class.reflect_on_association(association_name).klass.name} with ID=#{record_id} for #{self.class.name} with ID=#{id}"
end
end

0 comments on commit 136e3a4

Please sign in to comment.
Something went wrong with that request. Please try again.