> On Jul 18, 2016, at 1:24 AM, matthew keable <
matthew....@gmail.com> wrote:
>
> Hey everyone,
>
> I'm having a difficult time getting this to work. The guide I'm following covers most of the material, but I feel like there are a couple omissions. One being the controller:
> User.find_by_approved(false)
> ...which results in a NoMethodError and undefined method "each" when I click the link_to "Users awaiting approval".
It sounds to me like you expected a collection of unapproved users, but any of the find_ methods return a single record. Try changing this to where(approved: false), which will probably do what you want.
>
> Two: the provided controller method includes no way of actually approving users. Which should require another admin accessible controller function - but for update. Right?
Right. You will be approving a single record, so find it first (by its ID) and then update it.
Walter
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "Devise" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
plataformatec-de...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.