Editing Many to Many Records
Buy or Subscribe
You can access this course in just a minute, and support my efforts to rid the world of crappy online courses!
We have many playlists, we have many tracks. How do we assign a track to a playlist using our Rails forms? Turns out, it's pretty easy:
<h2 class="text-2xl mt-2">Playlists</h2> <table> <%=form.collection_check_boxes(:playlist_ids, Playlist.all, :id, :name) do |b| %> <tr> <td><%= b.check_box %></td> <td><%= b.label %></td> </tr> <% end %> </table>