-
-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
undefined method `preload' for RailsConfig::Integration::Rails::Railtie:Class (NoMethodError) #111
Comments
I'm having the same problem with the same version of Rails and Ruby |
The two lines below need to be executed in your Bundler.require(*Rails.groups)
RailsConfig::Integration::Rails::Railtie.preload |
Instead of loading Config before loading Rails, could you describe your usage scenario? I have already made Config available on the earlier Rails loading stages (like to be able to use it in database.yml), so maybe your scenario is general enough that we can provide a general solution for this? |
Move the two lines into your Application class block in application.rb. I found I had to change "RailsConfig" to "Config" to get it to tie in. So: Bundler.require(*Rails.groups) becomes: Bundler.require(*Rails.groups) |
I am having the same problem. Not sure if this is a correct way to go, but moving the line |
My scenario: config used in a Rails engine initialiser. Everything works fine in the Rails app, but rake test inside the engine fails. YaroSpace's fix solves the problem. P.S. are there special guidelines on how to use config in an engine? |
I am also using it in the engine and also in the wrapper apps.
This assumes that |
Thanks, I'll experiment with that, although in my case I don't foresee using engine specific configuration, just the wrapper ones (and of course the test/dummy ones). |
I updated the rails integration code like @YaroSpace suggests and pushed to the repo (no new gem release yet, so you would have to test it referencing github repo). The description in README about manually loading preload should not be valid anymore IMHO, as the config should load by default before Rails application configuration. See #145 If someone could test and confirm, it would be awesome! |
… undefined method `preload` error (based on @YaroSpace suggestion in #111)
This seems to be fixed now. Please comment if you feel it is still not working properly. |
I am trying to load rails_cofig before rails loads. Followed the instructions give in the README. Here is my
application.rb
But this fails with error
Rails version -
Rails 4.2.3
Ruby version -
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
The text was updated successfully, but these errors were encountered: