2

stylesheet_link_tagjavascript_include_tag在我将 rails 从 2.x 更新到 3.1.3 (3.1.0) 后停止工作

日志

Started GET "/urls/604" for 77.88.42.27 at Mon Nov 21 11:00:20 +0200 2011
  Processing by UrlsController#show as */*
  Parameters: {"id"=>"604", "collection"=>{"tag_suggestions"=>:get}}
  Url Load (0.8ms)  SELECT `urls`.* FROM `urls` WHERE `urls`.`id` = ? LIMIT 1  [["id", "604"]]
  Comment Load (0.9ms)  SELECT `comments`.* FROM `comments` WHERE (is_active = 1 AND url_id = '604') ORDER      BY created_at DESC
Rendered shared/_comments.html.erb (0.0ms)
Rendered urls/show.html.erb within layouts/application (57.6ms)
Compiled global.css  (0ms)  (pid 28092)
Completed 500 Internal Server Error in 663ms

ActionView::Template::Error (wrong number of arguments (2 for 1)):
    19:   -->
    20: 
    21: 
    22:   <%= stylesheet_link_tag 'global' %>
    23:   <%= javascript_include_tag 'jquery-1.6.4.min.js' %>
    24:   <%= javascript_include_tag 'jquery.corner.js' %>
    25:   <%= csrf_meta_tag %>
  app/views/layouts/application.html.erb:22:in     `_app_views_layouts_application_html_erb___1824233644_17244817840'

我该如何解决这个问题?

4

2 回答 2

1

你的 CSS 文件有效吗?可能是那里的某些东西(可能是旧的浏览器黑客或类似的非标准语法)正在绊倒 Sprockets。

您可能会发现这有助于了解 Rails 3 如何管理 CSS/JS http://guides.rubyonrails.org/asset_pipeline.html

于 2011-11-21T10:32:46.767 回答
0

从 Rails 3.0 迁移到 Rails 3.1 后,我们看到了这个错误。我们的问题是我们在 application_helper.rb 中有一个名为asset_path 的助手。asset_path 对 Rails 3.1 至关重要,我们无意中覆盖了它。

于 2012-06-11T20:11:14.667 回答