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

small modifications for rails 5 api flag #3

Open
jlr7245 opened this issue Jun 13, 2017 · 0 comments
Open

small modifications for rails 5 api flag #3

jlr7245 opened this issue Jun 13, 2017 · 0 comments

Comments

@jlr7245
Copy link

jlr7245 commented Jun 13, 2017

Thanks so much for the tutorial, it was great and worked with a few slight modifications.

I had to rename the token column to auth_token (so, rails g model user name auth_token email password_digest). This of course meant I had to change token to auth_token in a number of places: api_controller.rb, sessions_controller.rb, models/user.rb.

I was using a postgresql database and as @jaeming in #1 mentioned had to modify the migration: create the user table first and then, in a separate migration, add the index.

In sessions_controller.rb, I had to change user.regenerate_token to user.regenerate_auth_token.

And I had to modify the ApplicationController to look like this:

class ApplicationController < ActionController::API
    include ActionController::HttpAuthentication::Token::ControllerMethods
end

(I'm being as explicit as possible about my modifications because I suspect some of my students will find this tutorial and run into all the exact same bugs I did 😉 )

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

No branches or pull requests

1 participant