ruby on rails - How can I use will_paginate on a collection of partials away from an index page? -
i have users page displays reviews user has written. each review displayed partial (named _profile) , shown on page of accordian. how can add pagination these review partials?
users show page
<div class="profile_reviews_container"> <div id="accordion"> <h3><a href="#">reviews written</a></h3> <div class="profile_reviews_cont"> <% @user.reviews.each |review| %> <%= render "reviews/profile", :profile => review %> <% end %> </div> <h3><a href="#">favourites</a></h3> <div> </div> </div> </div> which controller add .paginate call , view contain <%= will_paginate @reviews %> or <%= will_paginate @profiles %>?
thanks appreciated!
i paginate reviews in users#show action. like:
@reviews = @user.reviews.paginate page: params[:page] and call:
<%= will_paginate @reviews %> in view.
i change name of partial (or create new one) reviews/_review can call:
<%= render @reviews %> but that's me.
Comments
Post a Comment