rails-secrets icon indicating copy to clipboard operation
rails-secrets copied to clipboard

Make it rails 3.2.11 compatible.

Open raskhadafi opened this issue 11 years ago • 5 comments

Rails 3.2 uses to store the secret_key the config secret_token. So I extended the initializer. Can you merge it?

Thanks in advance.

raskhadafi avatar Jun 17 '14 14:06 raskhadafi

Hmm, I don't think we should set both - we should try to do some feature detection. I think Rails 4 had a backwards compatible mode for secret_token - maybe you can look at that as a starting point?

pixeltrix avatar Jun 19 '14 06:06 pixeltrix

Ok, I'll give it another shot. I thought I'll push it cause of the working tests. Maybe your test should also receive an update. Cause my rails app where I integrated the gem crashed after the first request had to be made.

raskhadafi avatar Jun 23 '14 08:06 raskhadafi

@raskhadafi yes, please do update the tests - if you want to you could adapt them to use the appraisal gem to make sure it works across both 3.2 and 4.0.

pixeltrix avatar Jun 23 '14 09:06 pixeltrix

I did a little research and in the rails guides under the point 4.7 Action Pack they recommend to set both.

# config/initializers/secret_token.rb
Myapp::Application.config.secret_token = 'existing secret token'
Myapp::Application.config.secret_key_base = 'new secret key base'

So my solution should work. What do you think @pixeltrix ?

raskhadafi avatar Jun 25 '14 08:06 raskhadafi

An alternate solution would be to change the railtie to use before_initialize, then we could modify our 3.2 secret_token.rb to

RailsFrontend::Application.config.secret_token = RailsFrontend::Application.config.secret_key_base

@pixeltrix I could do a pull request for the change if your interested.

cmar avatar Jul 23 '14 14:07 cmar