简体   繁体   English

Rails路由错误与公用文件夹中的资产

[英]Rails route errors with assets in public folder

I'm a rails newbye and I'm studying the asset pipeline. 我是Rails的再见者,正在研究资产管道。

I'm creating a new app starting from a Themeforest Theme: I have a lot of assets (js, css) and I put the asset folder in the "public" folder of the rails app. 我正在从Themeforest主题开始创建一个新的应用程序:我有很多资产(js,css),并将资产文件夹放在rails应用程序的“ public”文件夹中。

I'm in development mode, and I have a problem: my assets path change with the page route: in my page index everything works, when I call a controller, for example "product", I lose every assets because the app search for my css and js under "product/assets" instead of "/assets". 我处于开发模式,但是我遇到了一个问题:我的资产路径随页面路线而变化:在我的页面索引中,所有东西都可以正常工作,当我调用一个控制器(例如“产品”)时,我会丢失所有资产,因为应用程序搜索我的CSS和JS在“产品/资产”下,而不是在“ /资产”下。

What's the cause of this behavior? 这种行为的原因是什么?

Found the solution: 找到了解决方案:

I forgive the "/" in front of every path :( 我原谅每个路径前面的“ /” :(

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM