<div dir="ltr">User is indeed a subclass of ActiveRecord::Base, and current_user is a User, and yet include appears to fail magically.<div><br></div><div>I'm going to stick to testing on IDs, then, which works, and perhaps try to understand this another day.</div><div><br></div><div>t.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 21, 2015 at 4:10 PM, Tom Stuart <span dir="ltr"><<a href="mailto:tom@codon.com" target="_blank">tom@codon.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 21 Apr 2015, at 15:56, Stephen Best <<a href="mailto:bestie@gmail.com">bestie@gmail.com</a>> wrote:<br>
> 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.<br>
<br>
</span>If `User` is a subclass of `ActiveRecord::Base`, the `User#==` method should already do this: <a href="https://github.com/rails/rails/blob/4-2-stable/activerecord/lib/active_record/core.rb#L377-L391" target="_blank">https://github.com/rails/rails/blob/4-2-stable/activerecord/lib/active_record/core.rb#L377-L391</a><br>
<br>
Cheers,<br>
-Tom<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br>
Archives: <a href="http://lists.lrug.org/pipermail/chat-lrug.org" target="_blank">http://lists.lrug.org/pipermail/chat-lrug.org</a><br>
Manage your subscription: <a href="http://lists.lrug.org/options.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/options.cgi/chat-lrug.org</a><br>
List info: <a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Tom Armitage<br><a href="http://infovore.org" target="_blank">http://infovore.org</a><br>07813 060578</div>
</div>