I'm building an engine I've bundled as a gem (gmaps4rails). I copied the /public of my engine in the /public of my rails app.
Everything works fine in development but fails to work in production: it appears static assets (of my engine & my main app) aren't found.
The logs tell the following (just an abstract):
Started GET "/javascripts/application.js?1286294679" for 127.0.0.1 at Wed Nov 24 00:22:20 +0100 2010
ActionController::RoutingError (No route matches "/javascripts/application.js"):
Rendered /Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.1ms)
Started GET "/stylesheets/gmaps4rails.css?1290554221" for 127.0.0.1 at Wed Nov 24 00:22:20 +0100 2010
ActionController::RoutingError (No route matches "/stylesheets/gmaps4rails.css"):
I've done a few things:
in my app's production.rb, I set:
config.serve_static_assets = true
This Solves the problem but is not elegant enough, I'd like to keep it to false and add configuration in the engine :)
I followed the advice here without success.
For performance reason, static assets serving is disabled in production mode. Your webserver should be configured to serve theses assets.
Look at this discussion if your are using nginx as a webserver.