mardi 19 mai 2015

Devise with multiple models and clients

I have a Rails 3 application with a Devise authenticated model (let's call it User). The application is a backend for a mobile app, so all responses are in JSON.

Now I want to add another model (let's call it NewUser) with authentication and this model will interact with users via a regular browser.

So I ran rails g devise new_user and ran the migration. Now I can sign up but when I try to sign in the browser's authentication dialog pops up and the database is queried with SELECT "users".* FROM "users" WHERE "users"."authentication_token" = 'cgrzchjd@sharklasers.com'.

Any ideas on why the browser's popup appears? I think it might have something to do with the line config.token_authentication_key = :auth_token in devise.rb, but I'm not sure. Also, how do I get Devise to query new_users instead of users?

Aucun commentaire:

Enregistrer un commentaire