我使用rails <select>
创建了一个select_tag
标记,我在JS中填充其内容。所以我想把它初始化为空,但是当我写的时候。
= select_tag "program", "<option></option>".html_safe, include_blank:true
我收到以下错误:
app/views/welcome/index.html.haml:53: syntax error, unexpected ';', expecting ')' ));}\n #{_hamlout.format_scri... ^
这是我的完整表单,可能会导致错误:
=form_tag(controller: "school_applications", action: "calculate_price", method: "get", class: "calc_form") do
=select_tag "start_date", options_for_select(['February 9, 2015', 'April 6, 2015', 'May 4, 2015', 'June 1, 2015', 'June 29, 2015', 'July 27, 2015', 'August 25, 2015', 'September 21, 2015', 'October 19, 2015', 'November 16, 2015', 'December 14, 2015' ])
-@option_array = (2..52).each.map {|i| ["#{i} weeks", i]}
-@option_array = @option_array.unshift(["1 week", 1])
= select_tag(:duration,options_for_select(@option_array))
= select_tag(:fls_center,options_for_select( FlsCenter.all.map{|p| [p.name, p.id]})
= select_tag "program", "<option></option>".html_safe, include_blank:true
=submit_tag "Calculate Price"
答案 0 :(得分:1)
第52行末尾还需要一个)
=select_tag(:fls_center, options_for_select(FlsCenter.all.map{|p| [p.name, p.id]}))