【问题标题】:sprockets error链轮错误
【发布时间】:2011-09-16 20:13:07
【问题描述】:

当我为我的 rails 应用程序使用 rails 3.1 版本时。我收到了这个错误

    Routing Error

    No route matches {:action=>"show", :controller=>"assets", :id=>#<Sprockets::BundledAsset:0xa82189fc pathname="/Users/Apple/workplace/shop-3.1/app/assets/stylesheets/application.css", mtime=2011-08-30 22:34:42 +0800, digest="f4f1e8a7a49e8c6b1273daf5b61a1028">, :format=>"css", nil=>:request}

this is the error stack
actionpack (3.1.0.rc8) lib/action_dispatch/routing/route_set.rb:464:in raise_routing_error'
actionpack (3.1.0.rc8) lib/action_dispatch/routing/route_set.rb:454:ingenerate'
actionpack (3.1.0.rc8) lib/action_dispatch/routing/route_set.rb:493:in generate'
actionpack (3.1.0.rc8) lib/action_dispatch/routing/route_set.rb:518:inurl_for'
actionpack (3.1.0.rc8) lib/action_dispatch/routing/url_for.rb:143:in url_for'
actionpack (3.1.0.rc8) lib/action_view/helpers/url_helper.rb:107:inurl_for'
actionpack (3.1.0.rc8) lib/action_dispatch/routing/route_set.rb:200:in asset_path'
actionpack (3.1.0.rc8) lib/sprockets/helpers/rails_helper.rb:58:inblock in stylesheet_link_tag'
actionpack (3.1.0.rc8) lib/sprockets/helpers/rails_helper.rb:48:in collect'
actionpack (3.1.0.rc8) lib/sprockets/helpers/rails_helper.rb:48:instylesheet_link_tag'
actionpack (3.1.0.rc8) lib/sprockets/helpers/rails_helper.rb:51:in block (2 levels) in stylesheet_link_tag'
actionpack (3.1.0.rc8) lib/sprockets/helpers/rails_helper.rb:50:inmap'
actionpack (3.1.0.rc8) lib/sprockets/helpers/rails_helper.rb:50:in block in stylesheet_link_tag'
actionpack (3.1.0.rc8) lib/sprockets/helpers/rails_helper.rb:48:incollect'
actionpack (3.1.0.rc8) lib/sprockets/helpers/rails_helper.rb:48:in `stylesheet_link_tag'

【问题讨论】:

  • Rails 3.1 已经发布,也许更新你的 gem 看看问题是否仍然存在?
  • 是的,当我将rails版本更新到rails 3.1发布版本时也出现了错误
  • 最后,我发现它是我的旧控制器,名为 assets,与 sprockets 冲突
  • @wolff,你是怎么解决的?重命名控制器?

标签: ruby-on-rails sprockets


【解决方案1】:

还可以更改默认资产路径

config.assets.prefix = "/some_other_path"

见:Changing the assets Path

【讨论】:

    猜你喜欢
    • 2020-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-30
    • 2012-11-16
    • 2016-11-10
    • 2022-06-20
    相关资源
    最近更新 更多