Thanks Pat for looking into it. Am sorry i was confused. It actually
related to Will Paginate.
I got the solution though:
index
chaps = []
moduls = Modul.filter(params[:search], 1, params[:page],
get_conditions_hash, sort_order('created_at'))
moduls.each { |modul| chaps << modul.modulable }
@chapters = WillPaginate::Collection.create params[:page] || 1, 1,
chaps.size do |pager|
# inject the result array into the paginated collection:
pager.replace(chaps)
pager.total_entries = moduls.results[:total_found]
end
end
Thanks,
Pratik
On Aug 5, 4:27 am, Pat Allan <[email protected]> wrote:
> Hi Pratik
>
> It's been a while since I've looked into the WillPaginate code - but
> not sure how this question relates to Thinking Sphinx - doesn't seem
> you're using TS in the controller - paginate method is only for SQL.
>
> --
> Pat
>
> On 05/08/2009, at 1:48 AM, tispratik wrote:
>
>
>
>
>
> > Following is my controller code. How do i set thetotal_entriescount
> > in the paginated @chapters array?
>
> > def index
> > chaps = []
>
> > moduls = Modul.filter(params[:search], 10, params[:page],
> > get_conditions_hash, sort_order('created_at'))
> > moduls.each { |modul| chaps << modul.modulable }
>
> > �...@chapters = chaps.paginate :page => params[:page], :per_page => 10
> > end
>
> > Thanks,
> > Pratik
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---