我是 Ruby 和 ROR 框架中的新手.我尝试使用JQuery创建Web应用程序.我的步骤是:
I'm new in Ruby and in ROR framework. I try to create web app with JQuery. My steps are:
当我尝试在浏览器中查看页面时,看到错误消息:
when I try to see page in browser I see error with message:
Sprockets::Rails::Helper::AssetNotFound in LandingPage#index The asset "application.js" is not present in the asset pipeline. <%= javascript_include_tag "application" %>我做错了什么?我在Google上搜索了此错误,但没有找到任何好的解释.
What I doing wrong? I googled about this error, but I didn't found anything good explained.
推荐答案首先尝试重新启动服务器,通常不需要在资产中包含application.js文件.如果不起作用,则
first of all try to restart your server, generally there is no need to include application.js file in assets. if it doesn't work then
在您的 config / initializer / assets.rb 文件中添加以下内容:
add below in your config / initializer / assets.rb file:
Rails.application.config.assets.precompile += %w(application.js)注意:添加资产文件后,请不要忘记重启服务器.如果您在Inilalizers中进行了任何更改,则必须重新启动服务器才能看到效果.
Note: after adding in your assets file, don't forget to restart your server. If you do any changes in Inilalizers, you have to restart the server to see the effects.
更多推荐
资产"application.js"在资产管道中不存在
发布评论