Probles with will_paginate

I have a view and in the view i want to show the blog with somo conditions. The problem is when i want to display these blogs, because they are in an array. So how can i display them with pagination?

The view is the next:

              <% @blogs.each do |blog| -%>                 <li class="clearfix">                   <div class="image"><img src="/images/blogs.jpg?" title="Mis Blogs"></div>             <div class="title"><%= link_to "#{sanitize textilize(blog.title)}", conversatio_blog_path(blog), :title => "#{sanitize(blog.title)}" %></div>                   <div class="text">                       <%= I18n.t('tog_social.groups.model.created_at') %> <%=I18n.l(blog.created_at, :format => :long)%>                   </div>                 </li>         <%@order = params[:order] || 'created_at'               @page = params[:page]               @asc = params[:asc] || 'desc'               @blogs = [blog].paginate :per_page => 2,                                 :page => @page,                                 :order => @order + " " + @asc %>         <%= will_paginate @blogs %>               <% end -%>

I have a view and in the view i want to show the blog with somo conditions. The problem is when i want to display these blogs, because they are in an array. So how can i display them with pagination?

The view is the next:

         &lt;% @blogs\.each do |blog| \-%&gt;
           &lt;li class=&quot;clearfix&quot;&gt;
             &lt;div class=&quot;image&quot;&gt;&lt;img src=&quot;/images/blogs\.jpg?&quot;

title="Mis Blogs"></div> <div class="title"><%= link_to "#{sanitize textilize(blog.title)}", conversatio_blog_path(blog), :title => "#{sanitize(blog.title)}" %></div> <div class="text"> <%= I18n.t('tog_social.groups.model.created_at') %> <%=I18n.l(blog.created_at, :format => :long)%> </div> </li> <%@order = params[:order] || 'created_at' @page = params[:page] @asc = params[:asc] || 'desc' @blogs = [blog].paginate :per_page => 2,

The call to paginate to populate @blogs should be in the controller not here, something like @blogs = Blog.paginate :page => params[:page], :per_page => 2 This will put just two blogs into @blogs for you to display in the view. Look for a tutorial or examples of how to use paginate (I am sure there will be examples on the paginate website).

Colin