Hi, I am struggling with this problem for a while. I just want to have books listed according to the title but only one for each title with the latest volume.
Table for books id(book_id) series_id volume 1 230 4 2 435 56 3 230 12 4 123 12 5 230 12 6 123 15
Table for series id(series_id) series_name 123 Lost 230 Mist 435 Dragon Ball
This is what I have so far;
title has_many :books book belongs_to :title
list_controller def @title = Title.find(params[:id]) end
list.rhtml <table> <% @title.books.each do |book| %> <tr> <td><%= series_name %></td> <td><%= book.volume %></td> </tr> <% end %> </table>
Would like to see a list like this; Lost 15 #does not show Lost 12 Mist 12 #does not show Mist 4 and other Mist 12 Dragon Ball 56
Please help