will paginate - Rails 4 - will_paginate -
this first attempt using will_paginate (i know! have been??)
titles_controller.erb
def index @titles = title.active.sorted.paginate(:page => params[:page]) end
index.html.erb
<% will_paginate @titles.each |title| %>
error:
undefined method `total_pages' #<enumerator:0x00000002bacaf0>
wtf doing wrong? in advance.
please read paginate docs. need write:
<%= will_paginate @posts %>
there no need adding each
.
so entire view like:
<% @titles.each |title| %> <!-- smth title --> <% end %> <%= will_paginate @titles %>
Comments
Post a Comment