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
uninitialized constant HighVoltage::StaticPage #146
Comments
Which version of Rails are you using? It looks like your rails app is not picking up the |
@harlow, I'm using rails 3.2.18 and ruby 2.0.0p481. |
Can you try adding the layout to the config block? HighVoltage.configure do |config|
config.route_drawer = HighVoltage::RouteDrawers::Root
config.action_caching = true
config.page_caching = true
config.home_page = 'home'
config.content_path = 'static'
config.layout = 'landpages'
end Make sure to restart the server, and then comment out the line in the Routes file. |
When I started the server I tried to access my page i got.
After hit reload i got:
This is happening every time I restart the server, downgrading to 2.1.0 makes high_voltage work fine. |
Same issue. |
Perhaps related to 2f99d07 ? |
@rossdakin good eye. I think thats correct. I suspect this is an issue with Rails 4 vs Rails 4.1. Will experiment locally and see if I can reproduce. |
@harlow thanks for looking into it – FWIW we're on Rails 3.2.18 |
Getting the routing issue with Rails 4.1.1 |
I've been trying a similar configuration locally and haven't been able to reproduce this. Have you had a chance @harlow? Any luck? |
This is due to Rails autoloading being not thread-safe. Are you doing something that requests multiple HighVoltage pages at the same time, or close to it in development or test mode? (e.g. ajax requests?) |
The commit message at 2f99d07 would imply it was attempting to solve the issue there, as well. There's an undocumented method called |
Also, this issue can be worked around by requiring the controller in an initializer. |
@dgalarza I haven't been able to reproduce either using |
Just upgraded to 2.2.0. Getting the same error. Rails 3.2.18, Ruby 2.1.1. Here's my initializer:
Upon first request of a static page, I get I tried requiring the controller in the initializer:
Then I just get the error on startup:
I'm not overriding anything -- totally vanilla HighVoltage setup. Anything else I can do to get 2.2.0 to work? Or should I just downgrade? |
@raphaelcm this may be a bit of a reach but could you also try requring the static page in the initializer too: require 'concerns/high_voltage/static_page'
require 'high_voltage/pages_controller' I suspect this is a Rails 3.x vs Rails 4.x issue because Rails 4 includes the |
@harlow that worked, thanks! |
@cirdes @rossdakin let me know if this works for you too. I'll get the README updated so its clear what people using Rails 3.x need to do. |
We've been seeing some issues with Rails 3 applications unable to find the `StaticPage` module. * Add custom require for Rails 3 #146
We've been seeing some issues with Rails 3 applications unable to find the `StaticPage` module. * Add custom require for Rails 3 * Update quotes to match new style guide #146
We've been seeing some issues with Rails 3 applications unable to find the `StaticPage` module. * Add custom require for Rails 3 * Update quotes to match new style guide #146
I just upgraded my application to Rails 4, I'm not having that issue anymore. But thanks for your time. |
OK great. Closing the issue. I have a PR open that should fix the error for Rails 3 users: #155 |
Awesome, thanks all. Haven't tested, but excited about the fix. Any chance of revving a new gem with this in it? |
After upgrading from 2.1.0 to 2.2.0 this error started to appear.
initializers/high_voltage.rb
routes.rb
static_controller.rb
The text was updated successfully, but these errors were encountered: