[LRUG] Clearance: problems with equivalence of #current_user

Stephen Best bestie at gmail.com
Tue Apr 21 07:56:03 PDT 2015


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.

Hope that helps, Bestie.

theaudaciouscodeexperiment.com
github.com/bestie
@thebestie

On 21 April 2015 at 15:14, Tom Armitage <tom at infovore.org> wrote:

> So I'm working on a project using Clearance for authentication, and Pundit
> for authorization/permissions. I'm particularly enjoying working with
> Pundit.
>
> However, I'm running into an issue on the front-end that I don't run into
> in my tests: whenever I ask if #current_user is include?ed in the list of
> users who have permission to do a thing, I inevitably get 'false' back -
> even if they're on that list. By contrast, the moment I ask if
> current_user.id is in users.map(&:id) - well, that works fine.
>
> So it feels like there's an issue around equivalence, which makes a bit of
> sense, but I have no idea why; all the Clearance docs suggest I can just
> use current_user as and when.
>
> Any thoughts or advice? I hope that came over as clear enough.
>
> Best,
>
> t.
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20150421/7ecc8e14/attachment-0003.html>


More information about the Chat mailing list