我正在构建一个捆绑为 gem (gmaps4rails) 的引擎。我将 /public 的引擎复制到了我的 rails 应用程序的 /public 中。
在开发中一切正常,但在生产中无法正常工作:似乎找不到静态资产(我的引擎和我的主应用程序的)。
日志告诉以下内容(只是摘要):
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"):
我做了几件事:
在我的应用程序 production.rb 中,我设置:
config.serve_static_assets = true
这解决了问题但不够优雅,我想将其保持为 false 并在引擎中添加配置:)
我按照这里的建议没有成功。