Closed krschacht closed 14 years ago
Even with the updated actiondispatch line, I still can't get my public assets to serve in production
I tried today with Rails 3.0.0, locally, with Webrick, and it worked.
I initially got some trouble because I did not change the necessary configuration in the main application.
So, to serve static assets in production, you need to do:
Insert an ActionDispath::Static after the one of the main app:
(this is already done with an initializer in lib/
app.middleware.insert_after ActionDispatch::Static, ActionDispatch::Static, "#{root}/public"
The latter is already written in the ReadMe, but not very clearly.
They only serve when the gem line is pointing to my local code.
Do you mean you publish your engine gem on rubygems? (and so not using it with a :path => /path/to/engine). It should work, but I did not try myself, because the public folder is included in the gem:
Gem::Specification.new do |spec|
spec.files = Dir["{app,config,public,lib}/**/*"]
end
So, can you serve static files locally in the production environment (RAILS_ENV=production rails s
), or is it only a problem when deployed?
If so, can you show me the line in your Gemfile for the engine?
Ahh, it was the spec files for me. I had broken that on my end. Adding public fixed everything, thanks!
Even with the updated actiondispatch line, I still can't get my public assets to serve in production. They only serve when the gem line is pointing to my local code.