Rails 3 stylesheet_link_tag和javascript_include_tag在更新后不起作用

时间:2011-11-21 09:24:07

标签: ruby-on-rails ruby-on-rails-3 stylesheet-link-tag

我将rails从2.x更新为3.1.3(3.1.0)

stylesheet_link_tagjavascript_include_tag已停止工作

日志

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'

我如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

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

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

非常有用

答案 1 :(得分:0)

将表单Rails 3.0移动到Rails 3.1后,我们看到了这个错误。我们的问题是我们在application_helper.rb中有一个名为asset_path的帮助器。 asset_path对Rails 3.1至关重要,我们无意中重写了它。