rubyconfig / config

Easiest way to add multi-environment yaml settings to Rails, Sinatra, Padrino and other Ruby projects.
Other
2.1k stars 230 forks source link

Blech, initializer still broken on latest Rails #72

Closed jacquescrocker closed 10 years ago

jacquescrocker commented 10 years ago

if you try to use Settings in environments/.rb, then it says "undefined constant Settings"

masterkain commented 10 years ago

same issue, but apparently worked fine on 0.3.3, I started getting this error on 0.3.4

deivid-rodriguez commented 10 years ago

Same issue here. Working fine with 0.3.3, failing after upgrading to 0.3.4. Maybe it's fixed again in 0.4.0, but it seems like that version hasn't been pushed to rubygems yet.

Cheers!

pkuczynski commented 10 years ago

hmm, I am using Rails 3.2.17 and with latest rails_config 0.3.4 from RubyGems that works fine and I can access Settings object from my environments/development.rb. Are you sure that you installed initializers/rails_config.rb and it does contain following lines?

RailsConfig.setup do |config|
  config.const_name = 'Settings'
end
deivid-rodriguez commented 10 years ago

Does it need to be called rails_config.rb? I have a file called _rails_config.rb. I think I renamed it like that so it would be loaded the first one and I could use Settings in the rest of the initializers.

pkuczynski commented 10 years ago

I checked and from 0.3.4 the Settings object is also available in application.rb which was part of the 0.3.4 fix.

pkuczynski commented 10 years ago

@deivid-rodriguez the file name does not really matter as far as I am aware. If it works for me with rails_config.rb it should work for you too for _rails_config.rb. However just to be safe, can you try to rename it?

deivid-rodriguez commented 10 years ago

No, it doesn't work in any case. This is a rails 4.1.0 app. Thanks for looking at this.

pkuczynski commented 10 years ago

Then maybe the reason is Rails 4.1 which you have vs Rails 3.2 which I use. I will test it and get back to you later on today.

deivid-rodriguez commented 10 years ago

ok, thanks.

deivid-rodriguez commented 10 years ago

By the way, do you know about appraisal? It's pretty cool for this kind of things. :)

kris commented 10 years ago

It works fine on 4.1.0 if you roll back to rails_config-0.3.3

deivid-rodriguez commented 10 years ago

Yep, it's a regression issue.

pkuczynski commented 10 years ago

After some investigation, I found out that the issue appeared only in Rails 4.1 and was caused by commit 5cebb8d from @railsjedi. I reverted this change and now it seems to be working fine.

I followed @deivid-rodriguez tip and used appraisal gem to run complete test suite against 3 different versions of Rails: 3.2, 4.0 and 4.1 (bootstrapped by running rails g in respective version of rails gem). This should prevent similar errors in the future.

Your feedback and code review is welcome!

jacquescrocker commented 10 years ago

thanks, sorry about that! On Apr 17, 2014 5:03 PM, "Piotr Kuczynski" notifications@github.com wrote:

After some investigation, I found out that the issue appeared only in Rails 4.1 and was caused by commit 5cebb8dhttps://github.com/railsjedi/rails_config/commit/5cebb8dfrom @railsjedi https://github.com/railsjedi. I reverted this change and now it seems to be working fine.

I followed @deivid-rodriguez https://github.com/deivid-rodriguez tip and used appraisal gem to run complete test suite against 3 different versions of Rails: 3.2, 4.0 and 4.1 (bootstrapped by running rails g in respective version of rails gem). This should prevent similar errors in the future.

Your feedback and code review is welcome!

— Reply to this email directly or view it on GitHubhttps://github.com/railsjedi/rails_config/issues/72#issuecomment-40775983 .

deivid-rodriguez commented 10 years ago

Thanks, works fine now!