Rails 具体版本是 3.1.3
要做省市二级联动的效果,省如下:
<%= f.select :name, Prefecture.all.collect{|p|[ p.name, p.id ]}.unshift(blank) %>
※这里用的是 form_for
搜索的结果大都是select的示例,如:
<%= select(:city, :name, @cities, {}, { "onchange" => remote_function(
:with => "'parent_id='+value",
:update => 'next_select',
:url => { :action => :select_with_ajax } ) })%>
按照这种方法去做,在f.select里加上{ "onchange" => remote_function(...,结果提示: undefined method `remote_function' for
怎么做呢?