Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialWarren Kushner
4,046 PointsInstalling gem('Devise')
In the Installing Devise section in creating the authentication system I am having trouble installing Devise. I put gem 'devise' in my gem file then entered bundler into the console. Bundler seems to work however the next step the video says that I need to enter the command (rails generate devise:install). This comes up with an error message below:
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-3.2.2/lib/devise/rails/routes.rb:475:in `raise_no_secret_key': Devise.secret_key was not set. Please add the following to your Devise initializer: (RuntimeError)
config.secret_key = 'de5f22489657fe2f53704cfb12eb79497b7bf2a87436ed8403b8e45f2d83f9c680e1483f4d82e3798f67be2d5fbc0c83fc9608139df5ae9c82759c9504e35773'
Please ensure you restarted your application after installing Devise or setting the key. from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-3.2.2/lib/devise/rails/routes.rb:203:in `devise_for'
I am not sure how to fix this. Help would be appreciated!
2 Answers
Lukasz R
707 PointsYou probably pasted 'config.secret_key = ' in the wrong place. Add it into file config/initializers/devise.rb ( you'll probably need to create it ). Don't forget about running "rails generate devise:install" command too :)
Garrett Flanagan
5,142 PointsI am having this same problem I didnt have a devise.rb file after installing so I created one in my initializers folder and pasted config.secret_key now I'm getting an undefined local variable error. I've tried a few other things and cant seem to get past this