1

How do you redirect to some action with cancancan based on role? Suppose I want the client role to be redirected to some different controller action, and all other roles to the default action.

for example:

def index

end

Is also the root action and after signing in all users redirected to index action.

Note: I use devise with cancancan.

tirdadc
  • 4,603
  • 3
  • 38
  • 45
yerassyl
  • 2,958
  • 6
  • 42
  • 68
  • 1
    Check the role, and `redirect_to` to appropriate URL. What's the problem? – Arslan Ali Jun 22 '15 at 10:06
  • 1
    possible duplicate of [How can I redirect a user's home (root) path based on their role using Devise?](http://stackoverflow.com/questions/4753871/how-can-i-redirect-a-users-home-root-path-based-on-their-role-using-devise) – Pavan Jun 22 '15 at 10:06
  • You can use Devise's `after_sign_in_path_for(resource)` to redirect according to the roles. – Pavan Jun 22 '15 at 10:10

0 Answers0