Forum: Ruby on Rails Abnormal Pagination Using SQL Server

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
09434aae87bf18164b1339253e93d554?d=identicon&s=25 Eric R. (Guest)
on 2005-12-23 01:14
I'm using RoR 1.0, Windows 2000, and SQL Server 2000. I am connecting to
the database using these directions:
http://wiki.rubyonrails.com/rails/pages/HowtoConne....

Using the scaffold generator to generate the default files (ruby
script/generate scaffold Location) I start up WebBrick and pull up the
page. There are 58 records in the table. I am given the first 10
records. No problem so far. Then I click the next page link - which
points to page 2 (page=2). I am presented with the same 10 records with
the same ten links. This continues for three more "next page" clicks for
a total of fifty. Then the really confusing part... on the the fifth
click I am only given eight of the same records.

In other words, Rails seems to know how many records there are but only
seems to be able to display the first 10 (or however many per page it's
set for). All other functions (edit, new, show, etc) appear to work
correctly.

Any help would be appreciated.

 - Eric
B56042e5ce2380fe17a5a1218e98b506?d=identicon&s=25 Ron DiFrango (Guest)
on 2005-12-23 16:04
(Received via mailing list)
Eric,

I have had that problem as well.  I thought I submitted a Ticket on this
one and it is the following:

http://dev.rubyonrails.org/ticket/3059


The only way to get around this is to override the default scaffold
[which most would tell you to do any way], and add the following to your
list method:

def list
    @exterior_selection_pages, @exterior_selections = paginate
:exterior_selections, :per_page => 20, :order_by=>"id ASC"
  end

Obviously substitute your object name for mine and your ID field as
well.  I would submit another ticket on this as this only seems to
affect SQL Server.

Just curious do you have an ID column or did you override it?

Ron


________________________________

From: rails-bounces@lists.rubyonrails.org on behalf of Eric R.
Sent: Thu 12/22/2005 7:14 PM
To: rails@lists.rubyonrails.org
Subject: [Rails] Abnormal Pagination Using SQL Server



I'm using RoR 1.0, Windows 2000, and SQL Server 2000. I am connecting to
the database using these directions:
http://wiki.rubyonrails.com/rails/pages/HowtoConne....

Using the scaffold generator to generate the default files (ruby
script/generate scaffold Location) I start up WebBrick and pull up the
page. There are 58 records in the table. I am given the first 10
records. No problem so far. Then I click the next page link - which
points to page 2 (page=2). I am presented with the same 10 records with
the same ten links. This continues for three more "next page" clicks for
a total of fifty. Then the really confusing part... on the the fifth
click I am only given eight of the same records.

In other words, Rails seems to know how many records there are but only
seems to be able to display the first 10 (or however many per page it's
set for). All other functions (edit, new, show, etc) appear to work
correctly.

Any help would be appreciated.

 - Eric

--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Rails mailing list
Rails@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails
09434aae87bf18164b1339253e93d554?d=identicon&s=25 Eric R. (Guest)
on 2005-12-23 23:51
Ron - thanks. That did the trick. I'm glad to know I'm not the only one
with this issue. Oh, and I am using an "id" column.

- Eric
This topic is locked and can not be replied to.