On Mar 18, 2009, at 1:58 PM, David Dollar wrote:
> Why not just use    unless object.new_record?
>
> It seems like any of the saved/existing/etc_record? have potentially
> non-obvious meanings.

Because object=Model.find_or_create...() will result in  
object.new_record? never being true. In my code, I have occasionally  
done:

   if object.new_record?.nil? # new_record? is false on create, but  
nil on find

Which is depending on a kind of behavior that is clearly subject to  
change. I could have been a bit more invasive with  
object.instance_variable_get("@new_record_before_save"), but.. "Ew!"

-Rob


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to