+1 for existing_record?

On Wed, Mar 18, 2009 at 11:04 AM, Mislav Marohnić <[email protected]
> wrote:

> On Wed, Mar 18, 2009 at 13:12, Olly Legg <[email protected]> wrote:
>
>>
>> It is along the same lines as the invalid? method. It adds a more
>> readable method for the opposite functionality.
>
>
> The name "saved_record?" might be misleading -- developers might think that
> this method returns false before the "save" method was called and true after
> the call:
>
>   user.saved_record? # => false
>   user.save
>   user.saved_record? # => true
>
> Of course, this is not what the method does ("dirty?" should be used for
> this).
>
> Why not "existing_record?"
>
>   user = User.new
>   user.existing_record? # => false
>   user.save
>   user.existing_record? # => true
>
> Sounds much better.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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