html文件中的语法错误

时间:2010-02-10 15:44:32

标签: ruby-on-rails

不完全确定错误指示的内容。我收到以下语法错误:

compile error
app/views/students/student_fail.html.haml:33: syntax error, unexpected tIDENTIFIER, expecting ')'
... :student_fail_attribute params[:StudentFailState.true], pa...
                              ^
app/views/students/student_fail.html.haml:33: syntax error, unexpected ')', expecting '='
...method], params[:text_method]) 
                              ^
app/views/students/student_fail.html.haml:39: syntax error, unexpected kENSURE, expecting kEND
...\n", -2, false);_erbout;ensure;@haml_buffer = @haml_buffer.u...
                              ^
app/views/students/student_fail.html.haml:40: syntax error, unexpected kENSURE, expecting kEND
app/views/students/student_fail.html.haml:42: syntax error, unexpected $end, expecting kEND

这是html:

 :ruby
       fields = if @step == 1
       [ select_tag(:id, options_from_collection_for_select(Student.passed, :id,   :selector_label, @student.id), :size => 10)  ]
    elsif @step == 2
       form_for @student do |f| f.collection_select( :student_fail_attribute params[:StudentFailState.true], params[:value_method], params[:text_method]) 
    end
    #fields << render_sequence_nav(sequence_info, students_path)
    fields << render(:partial => "resources_partials/sequence/nav", :locals => sequence_info.merge({:cancel_url => {:controller => :dashboard}}))

  = render_form { fields }

感谢您的回复。

1 个答案:

答案 0 :(得分:3)

我认为您错过了:student_fail_attributeparams[:StudentFailState.true]之间的逗号。

您可能想要考虑params[:StudentFailState.true]是否应该存在,除非它返回集合,否则您很可能无法获得预期结果。