Permalink
Browse files

Added a bang to the end of +raise_nested_attributes_record_not_found+

method to signify an exception possibly being raised.
  • Loading branch information...
1 parent 4d8e234 commit 3552760157415f0e91a5f4f53ea5ae0955117e83 @wangjohn wangjohn committed Apr 7, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 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 3552760

Please sign in to comment.