2009/9/6 Frederick Cheung <[email protected]>:
> Classes can implement their own == method. ActiveRecord::Base does do
> this, just not the way you want it too - ActiveRecord considers two
> objects to be equal if they correspond to the same row in the database
> (ie have the same id). If you have two unsaved objects then saving
> them would yield two different rows in the database, therefore by AR's
> reckoning they are not equal. While you could override == on your
> class that may well break bits of ActiveRecord that expects == to
> behave in a certain way.

thanks for the advice Frederick - I think I'll just implement my own
"custom_eql?" method on my class then to be safe....

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to