[LRUG] Clearance: problems with equivalence of #current_user

Tom Armitage tom at infovore.org
Tue Apr 21 08:25:35 PDT 2015


Thanks all, though. I think it's actually a knock-on effect of something
daft I did elsewhere. I'll keep investigating, though.

Best,

t.

On Tue, Apr 21, 2015 at 4:23 PM, Tom Armitage <tom at infovore.org> wrote:

> User is indeed a subclass of ActiveRecord::Base, and current_user is a
> User, and yet include appears to fail magically.
>
> I'm going to stick to testing on IDs, then, which works, and perhaps try
> to understand this another day.
>
> t.
>
> On Tue, Apr 21, 2015 at 4:10 PM, Tom Stuart <tom at codon.com> wrote:
>
>> 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
>> _______________________________________________
>> Chat mailing list
>> Chat at lists.lrug.org
>> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
>> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
>> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>
>
>
>
> --
> Tom Armitage
> http://infovore.org
> 07813 060578
>



-- 
Tom Armitage
http://infovore.org
07813 060578
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20150421/1c9f7bda/attachment.html>


More information about the Chat mailing list