Cannot use Devise Login with 2.0 #677

Closed
tibbon opened this Issue Jul 3, 2012 · 3 comments

Comments

Projects
None yet
2 participants

tibbon commented Jul 3, 2012

With 1.x versions of CanCan, I could access my /users/sign_in by having the following in my controller:

load_and_authorize_resource :unless => :devise_controller?

Now however, that doesn't seem to work. I tried allowing access to sessions and more of the devise stuff by putting this in my abilities model

can [:sign_in, :sign_up], :users
can :create, [:users, :sessions]

Still, no luck. Any ideas? Gotta be missing something simple.

tibbon commented Jul 3, 2012

I seem to have found the solution

enable_authorization do |exception|
  redirect_to root_url, :alert => exception.message
end unless :devise_controller?
Collaborator

andhapp commented Jul 3, 2012

Hey David, 2.0 is still in development and not stable at the moment.

Is there a reason to use 2.0 and not 1.x series?

I will try and have a look at it at some point but it won't be anytime soon. You are more than welcome to investigate and submit a pull request. :)

On 3 Jul 2012, at 21:12, David Fisherreply@reply.github.com wrote:

With 1.x versions of CanCan, I could access my /users/sign_in by having the following in my controller:

load_and_authorize_resource :unless => :devise_controller?

Now however, that doesn't seem to work. I tried allowing access to sessions and more of the devise stuff by putting this in my abilities model

can [:sign_in, :sign_up], :users
can :create, [:users, :sessions]

Still, no luck. Any ideas? Gotta be missing something simple.


Reply to this email directly or view it on GitHub:
#677

Collaborator

andhapp commented Jul 3, 2012

@tibbon: I've added your finding to the wiki . Thanks.

Will close this issue now.

andhapp closed this Jul 3, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment