How to authenticate only certain methods in your controller, using devise
Maybe a lot of people know how to do it but I struggled for a day trying to know how to do it, and if someone is wondering how, here is how
beforefilter :authenticateadmin!, :only => [:edit, :index, :update, :destroy, :show, :resolvecomplain]
beforefilter :authenticateuser!, :only => [:somemethod, :anothermethod]
In this case the user is only authenticated to to use somemethod and anothermethod and the admin can use edit, index, destroy, etc...
Written by Daniel villa
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Devise
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#