例如:
<%= f.select(, "XX_id", ProjectMember.get_projects(current_user.user_code).collect {|p| [p.project_name,p.project_id]}), {}, { "onchange" => remote_function(
:with => "'parent_id='+value",
:update => 'county_select',
:complete => "Element.show('county_select')",
:url => { :action => :select_with_ajax1 } ) })%>
表示,select列表ProjectMember...的值。并且自动选中ID为XX_id的值。这不是关键,关键是,只要用户选择了,那就会执行:action=>:select_with_ajax1的action,并传值parent_id=选中的value(id),执行的结果更新到当前面的DIV的ID等于county_select上来。