Custom rail environment, secret key complaint development
I created a new environment dev_fast_assets
where I do a lot of optimizations (precompiling assets ...) to improve the responsiveness of the website on slow laptops (because when asset maintenance takes 20 seconds + you end up drinking too much coffee)
So I basically created a new file in the /config/environments
(almost copy-paste from development.rb), I added mongoid.yml
, ldap.yml
and I believe that all you need to do.
But when I run rails s -e dev_fast_assets
I get
C:/Dev/Ruby21-x64/lib/ruby/gems/2.1.0/gems/devise-3.4.1/lib/devise/rails/routes.rb:480:in `raise_no_secret_key': Devise.secret_key was not set.
Please add the following to your Devise initializer:
config.secret_key = 'yyyy
Now I already have config.secret_key = 'xxxx'
(other than yyyy
) in mine config.initializers/devise.rb
and so far I have never had any problems with deploying in production using capistrano.
What am I missing? Basically I want my environment to dev_fast_assets
behave in much the same way as it does, development
except maybe one line out of two that changes ...
source to share
It might have something to do with the self-service 'active_reload'. Try removing it from the Gemfile and then try again. https://github.com/plataformatec/devise/issues/2641
source to share
I got the same error with Rails 4.1.2, Devise 3.2.4 and Devise-Invitable 1.3.5:
rake aborted!
Devise.secret_key was not set. Please add the following to your Devise initializer:
config.secret_key = '[128 hexadecimal characters]'
Please ensure you restarted your application after installing Devise or setting the key.
What I've done:
- Added a key to the file on demand (instead of
config/initializers/devise.rb:7
one that was commented out with another key) - Ran
rails g devise:install
. At the time, I had an environment variable withRAILS_ENV=demo
, but I don't know if this was required.
It seemed to work.
source to share