Rails 3 Engine & Static assets

后端 未结 6 1996
南旧
南旧 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:17

    I had a similar problem mounting a Rails 3.1 engine. I was receiving blank assets in stage and production.

    I found a solution at http://jonswope.com/2010/07/25/rails-3-engines-plugins-and-static-assets/comment-page-1/#comment-87 and tweaked it to suit Rails 3.1 asset locations:

    initializer "static assets" do |app|
      app.middleware.insert_before ::Rack::Lock, ::ActionDispatch::Static, "#{root}/app/assets"
    end
    

    I imagine there is a more elegant way but my effort today didn't yield anything substantial.

提交回复
热议问题