Rails 3.1资产管道路由错误
这个问题之前已经被问过很多次了,但是我尝试过的都没有效果,我已经尝试解决这个问题两天了。
我正在尝试将我的应用程序迁移到rails 3.1,因为我开始使用backbone和coffeescript,并认为升级整个应用程序是有意义的。
我关注了railscast,浏览了大量的博客等等。不幸的是,在这一点上我什至没有尝试加载主干页面,jquery 本身没有被加载。
我尝试导航到 localhost:3000/assets 并获取 没有路由匹配 [GET]“/assets”
Rails.application.config.assets.paths 的输出是
["/media/sf_Ruby192/mysite/app/assets/images", "/media/sf_Ruby192/mysite/app/assets/javascripts", "/media/sf_Ruby192/mysite/vendor/assets/javascripts", "/home/pete/.rvm/gems/ruby-1.9.2-p290/gems/cocoon-1.0.15/app/assets/javascripts", "/home/pete/.rvm/gems/ruby-1.9.2-p290/gems/formtastic-2.0.2/app/assets/stylesheets", "/home/pete/.rvm/gems/ruby-1.9.2-p290/gems/jquery-rails-1.0.19/vendor/assets/javascripts", "/home/pete/.rvm/gems/ruby-1.9.2-p290/gems/admin_data-1.1.16/app/assets/images", "/home/pete/.rvm/gems/ruby-1.9.2-p290/gems/admin_data-1.1.16/app/assets/javascripts", "/home/pete/.rvm/gems/ruby-1.9.2-p290/gems/admin_data-1.1.16/app/assets/stylesheets"]
所以这让我相信资产路径设置正确。
这里有什么建议吗?我在 Windows 上的虚拟机中运行它,因此根目录的路径是 /media/sf_Ruby192,这是 Windows 上的路径。
清单文件是
//= require jquery //= require jquery_ujs //= require_self //= require_tree .
This has been asked many times before, but nothing that I've tried has worked, and I've been trying to resolve it for two days now.
I'm trying to migrate my app to rails 3.1 because I'm starting to use backbone and coffeescript and figured it made sense to just upgrade the whole thing.
I've followed the railscast, been through tons of blogs, etc. etc. No luck, at the point I'm not even trying to load the backbone pages, jquery itself isn't being loaded.
I try to navigate to localhost:3000/assets and get
No route matches [GET] "/assets"
the output of Rails.application.config.assets.paths is
["/media/sf_Ruby192/mysite/app/assets/images", "/media/sf_Ruby192/mysite/app/assets/javascripts", "/media/sf_Ruby192/mysite/vendor/assets/javascripts", "/home/pete/.rvm/gems/ruby-1.9.2-p290/gems/cocoon-1.0.15/app/assets/javascripts", "/home/pete/.rvm/gems/ruby-1.9.2-p290/gems/formtastic-2.0.2/app/assets/stylesheets", "/home/pete/.rvm/gems/ruby-1.9.2-p290/gems/jquery-rails-1.0.19/vendor/assets/javascripts", "/home/pete/.rvm/gems/ruby-1.9.2-p290/gems/admin_data-1.1.16/app/assets/images", "/home/pete/.rvm/gems/ruby-1.9.2-p290/gems/admin_data-1.1.16/app/assets/javascripts", "/home/pete/.rvm/gems/ruby-1.9.2-p290/gems/admin_data-1.1.16/app/assets/stylesheets"]
So this leads me to believe that the assets paths are set-up correctly.
Any suggestions here? I am running this in a virtualbox on windows, hence the path from root being /media/sf_Ruby192, which is the path on windows.
The manifest file is
//= require jquery //= require jquery_ujs //= require_self //= require_tree .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我看到您已经解决了问题,但为了将来的参考,需要指出的是:
当您处于开发模式时,
localhost:3000/assets
将始终呈现“无路由”错误。I see you have fixed the problem but for future reference it is useful to point out:
When you are in development mode,
localhost:3000/assets
will always render a No route error.