[LRUG] Clearance: problems with equivalence of #current_user

Tom Stuart tom at codon.com
Tue Apr 21 08:10:18 PDT 2015


On 21 Apr 2015, at 15:56, Stephen Best <bestie at gmail.com> wrote:
> To make Array#include? work as you expect for two different instances of the same user record you would have to redefine equality (User#==) in terms of the object values or maybe just the id.

If `User` is a subclass of `ActiveRecord::Base`, the `User#==` method should already do this: https://github.com/rails/rails/blob/4-2-stable/activerecord/lib/active_record/core.rb#L377-L391

Cheers,
-Tom


More information about the Chat mailing list