Ruby on rails 从集合中获取所选值\u选择轨道
我在表格中选择了一个集合作为:Ruby on rails 从集合中获取所选值\u选择轨道,ruby-on-rails,selection,Ruby On Rails,Selection,我在表格中选择了一个集合作为: <%= rf.collection_select :u_org, Org.all, :id, :name %> 我希望从该表单帮助器中选择值,以便根据此选择填充另一个集合,如: <% @org = Org.find_by_id(##the selected id##) %> 因此,这是填充的: <%= rf.collection_select :depart, @org.departments, :id, :departm
<%= rf.collection_select :u_org, Org.all, :id, :name %>
我希望从该表单帮助器中选择值,以便根据此选择填充另一个集合,如:
<% @org = Org.find_by_id(##the selected id##) %>
因此,这是填充的:
<%= rf.collection_select :depart, @org.departments, :id, :department_name %>
我已经试过了
<% @org = Org.first %>
它工作得非常好。请提供帮助。如果第二个选择的格式相同,则必须使用javascript$你能详细说明一下吗?