lundi 31 juillet 2017

Dynamic array of hashes in Sinatra

I have an array of hashes that I want to dynamically change the content on the page with. How do I show all the names of the hashes and when clicked, show the array of contacts in that particular hash?

At the moment I only have:

<% @lists.map do |list| %>
<% list.contacts.each do |contact| %>

This shows the contacts for every list, but how do I make only the selected lists' contacts show? I was thinking I could make the display to none for each container div and then when clicked, set that specific div to show - is there a more efficient way to do this?

Aucun commentaire:

Enregistrer un commentaire