Предыдущий вопрос здесь: Какова обычная практика по ограничению результата в RoR?
Вот users_controller:
def show
@user = User.find(params[:id])
@posts = @user.posts.paginate :page => params[:page]
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @user }
end
end
и мое шоуhtml.erb:
<%=h @posts.length %>
<%=h @posts.inspect %>
<%= will_paginate @posts %>
Но в браузере я получаю только это:
4 [#<Post id: 7, title: "I am a root", description: "what can I do", views: 8, created_at: "2010-07-12 15:16:26", updated_at: "2010-07-12 15:16:26", user_id: 32>, #<Post id: 8, title: "root Post two", description: "This is the second one.", views: 2, created_at: "2010-07-12 15:42:57", updated_at: "2010-07-12 15:42:57", user_id: 32>, #<Post id: 9, title: "The third one.", description: "Ok, this is the third ads", views: 3, created_at: "2010-07-12 15:43:18", updated_at: "2010-07-12 15:43:18", user_id: 32>, #<Post id: 10, title: "I type very many", description: "What is very many for?", views: 33, created_at: "2010-07-12 15:43:34", updated_at: "2010-07-12 15:43:34", user_id: 32>]
Кроме того, я не вижу ничего другого.
Я пытался снимать с консоли:
>> defined? WillPaginate
=> "constant"
>> [].paginate
=> []
>> ActiveRecord::Base.respond_to? :paginate
=> true