I am working on a Rails engine. The mechanism includes some static JS / CSS in its public folder, and I want these assets to be combined and served by the host application.
I added this to my engine.rb file:
initializer "static assets" do |app| app.middleware.insert_before(::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public") end
Interestingly, when I launch a dummy application inside the Rails mechanism itself or install it in a separate application in my file system via path :
gem 'my-engine', path: '~/my-engine`
everything works. But as soon as I publish RubyGems and install in another application through
gem 'my-engine'
static assets all 404.
Any ideas on how to diagnose? Is there anything else I need to do in the host application to ensure that static assets are pulled into + to be served? This is not a production environment because it does not even work in development.
source share