twitter bootstrap 3 - Will_paginate rails 4 not working with order('Created_at') -
i'm having issues getting will_paginate work here. i've tried couple different suggestions regarding controller keep getting number of different errors. basic question here how modify bit of code below in order "will_paginate" option work. i'm using bootstrap 3 , have entire controller , view posted below. thanks.
@pits = pit.order('created_at desc').group_by { |pit| pit.created_at.strftime("%b %y") }
pits controller
class pitscontroller < applicationcontroller def new @pit = pit.new end def index @pit = pit.all @user = user.find_by(params[:id]) @pits = pit.order('created_at desc').group_by { |pit| pit.created_at.strftime("%b %y") } end
pit index.html.erb
<div class = "container list-pits"> <%= link_to "add new pit", new_pit_path, class: "btn btn-default" %> <br> <br> <% @pit.each |pit| %> <div class = "row"> <div class = "container"> <div class = "well pit-well"> <h3 id="pit-title"><%= link_to pit.topic, pit_path(pit) %></h3> <p>by <%= link_to pit.author, '#' %></p> <br> <p><%= pit.summary %></p> <p>replies (<%= pit.comments.count %>)</p> <br> <p>pit created by: <%= link_to pit.user.name, current_user %> on <%= pit.created_at %></p> <%= link_to "join pit", '#', class: "btn btn-primary" %> </div> </div> <% end %> </div> </div>
Comments
Post a Comment