Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

two models with devise :authenticatable #11

Closed
bitzesty opened this issue Dec 21, 2009 · 12 comments
Closed

two models with devise :authenticatable #11

bitzesty opened this issue Dec 21, 2009 · 12 comments

Comments

@bitzesty
Copy link

I've got an admin model and an user model, the admin model does not have devise :facebook_connectable, but the user does. However when I try and login as an admin it fails with Admin undefined method facebook_connect (and the other FacebookConnectable class methods).

@bitzesty
Copy link
Author

i think it was the scoping not accepting :for => :user when I was on admin/sign_in

@grimen
Copy link
Owner

grimen commented Dec 22, 2009

OK, thanks, will look into this.

@grimen
Copy link
Owner

grimen commented Dec 29, 2009

Nested trap - is that really a best practice for warden/devise? I didn't see "pass" used in Devise authenticatable module, could you maybe elaborate on why it's needed for facebook_connectable? Feels incorrect when authenticatable is not doing this - should be same-same, right?

@bitzesty
Copy link
Author

Probably not best practice anywhere, however i need to do this as this strategy is called even when a model (such as my admin model) does not have facebook_connectable. pass is just the same as do nothing and try the next strategy, which is what i want.

The better way to achieve this would be to check if the model responded to facebook_connect then just pass if it doesn't. however I needed to hack this up quick

@grimen
Copy link
Owner

grimen commented Dec 29, 2009

OK, cool. Your second suggestion is most probably better. Will look on it when I get some time.

@bitzesty
Copy link
Author

Warden::Strategies are stored as a hash not an array, which explains why I only occasionally hit this error, as sometimes the normal auth strategy is chosen first

@bitzesty
Copy link
Author

i'm tired - it's late just looked at warden more closely and the correct place for klass.respond_to?(:facebook_connect) is in valid?

@grimen
Copy link
Owner

grimen commented Jan 7, 2010

I cannot reproduce this at all, but I posted this in Devise mailing list to be sure.

@grimen
Copy link
Owner

grimen commented Jan 7, 2010

This commit "should" solve this:

http://github.com/grimen/devise_facebook_connectable/commit/77d27440b5da3ab7a9edcc209f7d92ba67bbf2fb

Can you clone, build the gem, and try in your project please? I could not re-produce so...

@grimen
Copy link
Owner

grimen commented Jan 8, 2010

Hah, the reason I could not re-produce this was that I fixed the issue before I tried it. Didn't know that was the issue by then, so now I could reproduce this and the commit above fixes the issue. Now I'll bump the gem.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant