1
所以我有一个Rails 3.1应用程序。在模板文件中的一个(index.html.erb)我有这样的:asset_path未预先申请应用程序名称?
<%= image_tag('resource_icons/entitlements.png') %>
主要生产:
<img alt="Entitlements" src="/intl-custserv-web/assets/resource_icons/entitlements-e77a9dbcdfe3b5bdc5e1f3c3e373a0a7.png" />
而在一个CSS文件(dock.css.erb)我有这样的:
background-image:url(<%= asset_path("resource_icons/favorite-customers-icon-small.png"))
但是,这会产生:
background-image:url(/assets/resource_icons/favorite-customers-icon-small-613656faee70881de686d4524504a1e2.png)
我需要使用asset_path标记以与image_tag相同的方式预先加载应用程序名称。我错过了明显的东西吗?
谢谢!
这导致RackInitializationException“relative_url_root =没有找到方法。”我也尝试了这里的建议[https://github.com/rails/rails/issues/3365](https://github.com/rails/rails/issues/3365),但是这也没有奏效。这是我用来生成资产的命令:'jruby -S bundle exec rake assets:precompile'。我试过了,没有RAILS_RELATIVE_URL_ROOT参数。 – papaganouche 2012-03-13 13:41:34
嗯......这里有什么有用的吗? http://jira.codehaus.org/browse/JRUBY-6226 – JohnColvin 2012-03-13 13:56:01
好的,所以在我发布在最后一条评论中的链接中,我没有意识到pokonski的补丁没有包含在最新版本的Rails中。所以我进入了actionpack,并进行了他描述的编辑,然后对rake资源使用RAILS_RELATIVE_URL_ROOT参数:precompile命令作品。我想知道他的修补程序是否会包含在下一个版本中? –
papaganouche
2012-03-13 14:03:43