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 trial

Ruby

Justin Banta
Justin Banta
3,834 Points

Issue installing devise

my server won't run ever since I tried to install devise--needless to say it didn't install properly and I can't figure out how to address the issue. When I try to run the server or do the "rails generate devise" user command I'm getting this error: /usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-3.1.0/lib/devise/rails/routes.rb:445:in `raise_no_secret_key': Devise.secret_key was not set. Please add the following to your Devise initializer: (RuntimeError)

then it's followed by: "config.secret_key =" followed by a random string of characters

then there's a list of about 37 files reading: from file_location/filename:in 'something'

I can't figure out what to do. Any ideas?

Justin Banta
Justin Banta
3,834 Points

Ok I found this-it has to do with Devise 3.1 http://blog.plataformatec.com.br/2013/08/devise-3-1-now-with-more-secure-defaults/ https://github.com/plataformatec/devise/issues/2610 but I'm still having trouble finding devise_initializer.rb or rather the install didn't create it as far as I can tell... I'm sure this is a really easy fix; I'm just not seeing it

Justin I had same problem and could not find. I read there was a devise .rb in the configuration directory but I not find it. I will keep looking and post if I find . Chris

Justin Banta
Justin Banta
3,834 Points

yeah, I put 'config.allow_insecure_token_lookup = true' into config/initializers/devise.rb but I'm still getting the error, which probably means I'm just missing something obvious...

If you can find the file path using 'gem contents devise' then you should at least be able to open and edit it with TextEdit straight from the terminal using 'open -a TextEdit [file path]' (you can open it with sublime as well but that takes some setup)

1 Answer

Justin Banta
Justin Banta
3,834 Points

Ok, I fixed it by opening routes.rb and commenting-out 'devise_for :installs' and then re-runing rails generate devise:install