Rails 3 Engine & Static assets

后端 未结 6 1997
南旧
南旧 2020-12-29 14:34

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

6条回答
  •  执笔经年
    2020-12-29 15:25

    Have you tried adding this to your Rails::Engine class:

    initializer "static assets" do |app|
      app.middleware.use ::ActionDispatch::Static, "#{root}/public"
    end
    

    This will merge in your Gem's /public directory with the app at runtime.

提交回复
热议问题