enable/disable users

946 views
Skip to first unread message

anahoret

unread,
Jan 26, 2010, 11:46:04 AM1/26/10
to Devise
Hello

What is the best way to add enable/disable users to my application
with Devise?

Thanks

Carlos A. da Silva

unread,
Jan 26, 2010, 11:57:33 AM1/26/10
to Devise
You can create your own UsersController to manage users as any other
controller.

If you want to tell Devise to not allow inactive users to sign in, you
can override the :find_for_authentication class method Devise
provides:

def self.find_for_authentication(conditions={})
conditions[:active] = true
find(:first, :conditions => conditions)
end

anahoret

unread,
Jan 26, 2010, 12:10:15 PM1/26/10
to Devise
Actually I have similar implementation after reading
http://groups.google.com/group/plataformatec-devise/browse_thread/thread/723b8575ac8d8e9e

I need similar functionality very often, so may be after deep review
Device code I will add some submodule for simple reuse in the future.

Big thanks for help and for the quick replay.

Carlos A. da Silva

unread,
Jan 26, 2010, 12:19:27 PM1/26/10
to Devise
Cool.. Take a look at Activatable module, that should help you
achieving it as José pointed out in this thread.

On Jan 26, 3:10 pm, anahoret <slava.doda...@gmail.com> wrote:
> Actually I have similar implementation after readinghttp://groups.google.com/group/plataformatec-devise/browse_thread/thr...

Reply all
Reply to author
Forward
0 new messages