Filter

<% isLatest = session[:sort] == "latest" %> <%= link_to "Latest", url_for(sort: (isLatest ? "alpha" : "latest")), class: "btn btn-default btn-sm " + (isLatest ? " active" : ""), remote: true %> <%= render'layouts/initials' %>
<%= will_paginate class: "center" %> <% @books.each do |book| %> <% end %>
Name Authors Serie
<%= link_to book.title, book %> <% book.authors.each do |author| %> <%= link_to author.name, author %> <% end %> <% if book.serie %> <%= link_to book.serie.name, book.serie %> <%= book.series_index.to_i %> <% end %>
<%= will_paginate class: "center" %> <%= render'layouts/perpage' %>