This project is archived and is in readonly mode.

#6597 new
Damian Hamill

view helpers generating assets paths with engine prefix for parent application assets

Reported by Damian Hamill | March 19th, 2011 @ 09:16 PM

I want to create engines to embed in an application to add functionality but in most cases I want to use the parent application's layout and styles for a consistent look and feel. When accessing a view in an engine the assets included in the parent application's layout are prefixed with an auto generated engine prefix. I have an engine mounted at /svc with the following engine.rb file

module Svc
  class Engine < Rails::Engine
    config.asset_path = "/my_engine/%s"
  end
end

and the following helper reference in {app.root}/app/views/layouts/application.html.erb


    <%= stylesheet_link_tag "main" %>

When accessing /svc/index the output for this tag is

    <link href="/my_engine//stylesheets/main.css" media="screen" rel="stylesheet" type="text/css" />

removing the config.asset_path setting gives

 <link href="/svc_engine/stylesheets/main.css" media="screen" rel="stylesheet" type="text/css" />

No comments found

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages