List shows always first page


#1

Hello!

I’m a beginner of rails.
I made a simple test project with rails 1.1.2 and ruby 1.8.2 on Windows
XP.
DB is SQLServer 7.0.
I’m connecting the server thru ODBC.

I created a table named “users” with about 10 columns.
I inserted 1000 sample records.

I created a scaffold for user model and login controller for it using
the script.
Everything’s fine except that the pagination.
Be default the list shows 10 records per page.
I clicked “Next Page” and the page refreshed but the data is still same
as the first page.
The URL shows page=2 parameter.
I opened the controller code and found the following code.

def list
@user_pages, @users = paginate :users, :per_page => 10
end

I changed 10 to 100 and the page showed 100 records but still the 2nd
page showed the 1st page.

Did I miss something?
Or should I add code to make the pagination work?

Thanks.
Sam


#2

Sam K. wrote:

Hello!

I’m a beginner of rails.
I made a simple test project with rails 1.1.2 and ruby 1.8.2 on Windows
XP.
DB is SQLServer 7.0.
I’m connecting the server thru ODBC.

I created a table named “users” with about 10 columns.
I inserted 1000 sample records.

I created a scaffold for user model and login controller for it using
the script.
Everything’s fine except that the pagination.
Be default the list shows 10 records per page.
I clicked “Next Page” and the page refreshed but the data is still same
as the first page.
The URL shows page=2 parameter.
I opened the controller code and found the following code.

def list
@user_pages, @users = paginate :users, :per_page => 10
end

I changed 10 to 100 and the page showed 100 records but still the 2nd
page showed the 1st page.

Did I miss something?
Or should I add code to make the pagination work?

Thanks.
Sam

Oh, I figured that out.
I need to set :order option.
After setting it, it worked.