ページネーションは簡単にできますが、少し複雑な 2 つのモデルを使用しています。
まずはコントローラーです
class BrowseController < ApplicationController
def index
@hashtags = Hashtag.find(:all, :order => 'created_at DESC')
@posts = post.all
end
end
ビューは次のとおりです (browse\index.html.erb)
<ul>
<% @posts.each do |post| %>
<% if post.hashtags.present? %>
<li> <%= link_to post.hashtags.map{|h| "##{h.hashtags}"}.join(', '), post.user %> </li>
<% else %>
<% end %>
<% end %>
</ul>
私はそのビューをページネーションしようとしています。投稿だけではなく、投稿のハッシュタグです。正しい<%= will_paginate %>
コードは何でしょうか?
投稿自体だけでなく、投稿のハッシュタグをページ分割しようとしています。