Answer the question
In order to leave comments, you need to log in
How in Ruby on Rails can you find out what number this element is from the parent element?
For example, there are links to the Mercedes and Models tables.
So I display the models of this Mercedes through the loop:
<% Mercedes.each do |m| %>
<% p m.models.name # Как здесь узнать какой по числу это модель
<% end %>
Answer the question
In order to leave comments, you need to log in
I guess it will be something like: p a.index(m.models.name)
for an array and p a.key(m.models.name)
for a hash
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question