Forum: Ruby on Rails pagination problem

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.
334ae822566107a2ea2b7a7cb88bd1d6?d=identicon&s=25 Brutyn Nick (Guest)
on 2005-12-23 10:21
(Received via mailing list)
hey,

i have this problem

in the database i have 32 records
and the sql filtered 4 records

#getting the callerid records depending on the given paramaters and
paginate it
@callerid_pages = Paginator.new self, CallerId.count, 10,
@params['page']
@caller_ids = CallerId.find(:all, :conditions =>["geotags.firm_id = ? ",
@firm_id], :order => " geotags.address1 ASC", :include => [:geotag],
:limit=>@callerid_pages.items_per_page,
:offset=>@callerid_pages.current.offset)

How come i get extra next and previous tags, with no records diplays
when i count the next and previous tags, i get 4 pages, this could be
the 32
records. How can i change this, when i got 4 records, no tags are shown.

Thanks

Nick
334ae822566107a2ea2b7a7cb88bd1d6?d=identicon&s=25 Brutyn Nick (Guest)
on 2005-12-23 11:39
(Received via mailing list)
hey,

and when i do the normal way

@callerid_pages, @caller_ids = paginate :caller_id, :conditions =>
["caller_ids.geotag_id = geotags.id and geotags.firm_id = ? and
caller_ids.phone
like ? and caller_ids.geotag_id like ? and geotags.client_id like ? and
caller_ids.deleted like ? " + text, @firm_id, "%#{@phone}%",
"#{@geotag_id}",
"#{@client_id}",0] ,
:order => " geotags.address1 ASC", :include => [:geotag], :per_page =>
10


#42S02Unknown table 'geotags' in where clause: SELECT COUNT(*) FROM
caller_ids
WHERE (caller_ids.geotag_id = geotags.id and geotags.firm_id = 1 and
caller_ids.phone like '%%' and caller_ids.geotag_id like '%' and
geotags.client_id like '%' and caller_ids.deleted like 0  and
geotags.client_id
IN ( 274, 160, 3 ) )
This topic is locked and can not be replied to.