I
I
IvanN7772014-10-08 18:06:04
Ruby on Rails
IvanN777, 2014-10-08 18:06:04

How to implement the output of select( city ) on select( regions) similarly to the grouped_collection_select helper with only individual select s?

<%= f.grouped_collection_select :city_id,
@regions, :cities, :name,
:id, :name
How to display cities based on region.
But the field below(selectom)
Please tell me?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dexdev, 2014-10-08
@IvanN777

<% @user.ecategories.group_by{|e| e.parent_id}.each do |parent, ecategories| %>
                <%= link_to Ecategory.find(parent).name %>
              <ul class="user_category_ul">
                <% ecategories.each do |ecategory| %>
                  <%= ecategory.name %>,
                  <% end %>
              </ul>
              <% end %>

Something like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question