views:

152

answers:

1

Hey,

Not exactly sure what the errors are indicating. I am getting the following syntax errors:

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

Here's the 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 }

Thanks for any response.

+3  A: 

I think you are missing a comma between :student_fail_attribute and params[:StudentFailState.true].

You might want to think if params[:StudentFailState.true] is supposed to be there at all, unless it returns the collection you will most likely not get the expected results.

Jimmy Stenke
It gives undefined method `true' for :StudentFailState:Symbol. There are three records in that table. true is an attribute of the table. In essence, user has three options from drop down, I just want that 2 value to be updated to student_fail table and, hence, the :student_fail_attribute accessor. The value method is the ids of those three records and the text method is the name of them that appears on dropdown.
JohnMerlino
Ok, so `StudentFailState` is a table. If that is fixed, then I would suggest you to not include it in params. Change it to something like this: `f.collection_select(:student_fail_attribute, StudentFailState.all, :id, :name)`
Jimmy Stenke
When I change it to (:student_fail_attribute, StudentFailState.all, :id, :name), it returns an undefined method `join' for #<String error.
JohnMerlino