0

this code fails:

@user_pages, @users = paginate :users, :per_page => 40, :order => :name

rewriting it like this works:

@users = User.all.paginate(:page => params[:page], :per_page => 40)

but what does @user_pages, @users mean?

I take it that @users is being assigned to @user_pages?

joey

4

1 回答 1

0

不,@user_pages并且@users是从值数组返回的两个不同值。它们实际上是value[0]value[1]

一个 irb 示例应该会有所帮助:

MacBook-Pro:~ me$ irb
1.9.3-p429 :001 > a,b = [1,2]
 => [1, 2]
1.9.3-p429 :002 > a
 => 1
1.9.3-p429 :003 > b
 => 2
于 2013-07-15T20:51:48.633 回答