Permalink
Browse files

Use ! instead of not

  • Loading branch information...
1 parent 894fd28 commit 296e5c38f1b501d39c247f5b7daccedded4e497b @spastorino spastorino committed Nov 11, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/nested_attributes.rb
@@ -323,7 +323,7 @@ def assign_nested_attributes_for_one_to_one_association(association_name, attrib
(options[:update_only] || record.id.to_s == attributes['id'].to_s)
assign_to_or_mark_for_destruction(record, attributes, options[:allow_destroy]) unless call_reject_if(association_name, attributes)
- elsif not attributes['id'].blank?
+ elsif !attributes['id'].blank?
@gmile

gmile Nov 11, 2010

Contributor

Is this just a code convention fix? Or it has more basis than that?

@josevalim

josevalim Nov 11, 2010

Contributor

Just a code convention. Rails does not use "not".

@spastorino

spastorino Nov 11, 2010

Owner

Exactly as José said but anyways that way is better b734e19

@gmile

gmile Nov 11, 2010

Contributor

Oh, great. But are those code convention rules are stoned and open to public somewhere?

Btw, Santiago, I thought present? was "promoted" to empty? as a part of "less function calls" optimization wave. Isn't it?

@josevalim

josevalim Nov 11, 2010

Contributor

Paragraph 6.4 here: http://guides.rubyonrails.org/contributing_to_rails.html

About present? or empty?, it simply does not matter. So there is no need to worry about it.

raise_nested_attributes_record_not_found(association_name, attributes['id'])
elsif !reject_new_record?(association_name, attributes)

0 comments on commit 296e5c3

Please sign in to comment.