我创建了一个新的rails 3.2.0.rc1应用程序,并生成了一个带有索引操作的欢迎控制器。我修复了路由,以便root指向此操作,并删除了index.html占位符文件。当我尝试加载根页面时,我收到一个错误“错误的参数数量(3个2)”与welcome.css.scss和application.html.erb中的stylesheet_link_tag行相关。如果我将welcome.css.scss文件重命名为welcome.css,页面加载正常。
我是否错过了候选发布版的特殊配置步骤?我使用的是ruby 1.9.2。
感谢。
答案 0 :(得分:3)
我在1.9.3-p0
上遇到与3.2rc1相同的情况Started GET "/" for 127.0.0.1 at 2012-01-08 21:18:59 -0800
Processing by HomeController#index as HTML
Rendered home/index.html.erb within layouts/application (3.5ms)
Completed 500 Internal Server Error in 81ms
ActionView::Template::Error (wrong number of arguments (3 for 2)
(in /Users/dan/Sites/appname/app/assets/stylesheets/home.css.scss)):
2: <html>
3: <head>
4: <title>Appname</title>
5: <%= stylesheet_link_tag "application" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__3426015066428469059_70355741377500'
Rendered /Users/dan/.rbenv/versions/1.9.3-rc1/lib/ruby/gems/1.9.1/gems/actionpack-3.2.0.rc1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (9.5ms)
Rendered /Users/dan/.rbenv/versions/1.9.3-rc1/lib/ruby/gems/1.9.1/gems/actionpack-3.2.0.rc1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.6ms)
Rendered /Users/dan/.rbenv/versions/1.9.3-rc1/lib/ruby/gems/1.9.1/gems/actionpack-3.2.0.rc1/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (15.2ms)
我的home.css.scss如下
// Place all the styles related to the home controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
答案 1 :(得分:0)
看起来是rc1
错误。
我刚开启rails 3.2.0.rc2
,这个问题就消失了。