Tau
Tau

Reputation: 11

ROR- Syntax error

I has been banging my head over the wall for sometimes now. Don't know why I even get the syntax error on collection_select() when I am pretty sure it is correct. Please help Rail 2.1.1.

<%= f.collection_select (:location_id, Location.find(:all), :id, :name, :prompt => true, 
        {:onchange => remote_function(
        :url => {:action => "loc_selected", :controller => "location", 
            :id=> location.id},
        :with => "'location_id='+this.value")}) %>

compile error

c:/Users/Tau/rails_proj/incident/app/views/events/_general_step.html.erb:35: syntax error, unexpected ')', expecting tASSOC ..."'location_id='+this.value")}) ).to_s); _erbout.concat "\n ...

Upvotes: 0

Views: 168

Answers (1)

Mads Mob&#230;k
Mads Mob&#230;k

Reputation: 35990

You are missing curly braces around :prompt => true . This argument to collection select needs to be a hash. Fix it by using {:prompt => true}.

And please, format your code.

Upvotes: 1

Related Questions