开发者

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 开发者_JAVA百科..."'location_id='+this.value")}) ).to_s); _erbout.concat "\n ...


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜