Pagination problem


#1

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


#2

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 ) )