similar to: Paginator offset =0 ...

Displaying 20 results from an estimated 400 matches similar to: "Paginator offset =0 ..."

2007 Jun 20
1
Count_by_content ??
Is there a count_by_content alternative to the find_by_content action? This is because I''m wanting to do the following in my pagination method: def list # step 1: set the variables you''ll need page = (params[:page] ||= 1).to_i items_per_page = 20 offset = (page - 1) * items_per_page # step 2: instead of performing a find, just get a count item_count =
2006 Apr 23
0
Using Paginator outside of controllers
I am doing this in _messages.rthml: <% shout_pages = Paginator.new self, Shout.length, 30, @params[''page''] %> <% shouts = Shout.find :all, :order => "timestamp desc", :limit => @story_pages.items_per_page, :offset => @story_pages.current.offset %> I am calling
2006 Oct 02
6
Strange Sorting Issues
Hi there, I''m having some strange sorting stuff goign on. Here''s my search method: sort_fields = [] sort_fields << Ferret::Search::SortField.new("name", :reverse => :false) @results = Listing.find_by_contents @search_criteria, :limit => :all, :sort => sort_fields page = (params[:page] ||= 1).to_i items_per_page = 9 offset = (page - 1) *
2006 Jan 27
0
custom paginator generating Next link when not needed
I implemented a prefix search using the following custom paginator: @performer_pages = Paginator.new self, Performer.count, 25, @params[''page''] @performers = Performer.find( :all, :conditions => ["Name >= ?", params[:prefix] ], :order => "Name ASC", :limit => @performer_pages.items_per_page, :offset =>
2008 Apr 26
0
moving pagination code to model
Hi I have the controller code as below # step 1: set the variables you''ll need page = (params[:page] ||= 1).to_i items_per_page = 20 offset = (page - 1) * items_per_page # step 2: instead of performing the full find, just find the record count @search_sd_ticket_count_result =
2008 May 19
0
changed to will_paginate
Hi Till now we used the rails pagination.But now onwards shifting to will_paginate The code I use currently is as below .This is with the help of find_where pluggin..A fantastic pluggin which we still want to use...I would like to know how can i modify the following code to work with will_paginate step 1: set the variables you''ll need page = (params[:page] ||= 1).to_i
2008 Mar 06
1
pagination for an object array
def show_details @sd_ticket = ServiceDeskTicket.find(params[:id]) @servicedesk_cis = @sd_ticket.service_desk_cis end What I need is a pagination for @servicedesk_cis using the custom pagination..How can i give offset and limit to this? I have successfully done previously custom pagination in another def as below def search_sd_ticket @search_sd_ui_hash=params[:sd_ticket]
2005 Dec 29
0
strange output in http header
Hi there, I''m experiencing something strange in rails http headers. The response comes back as text/plain. The http header looks like this: HTTP/1.1 200 OK Date: Thu, 29 Dec 2005 15:18:18 GMT Server: Apache/2.0.54 (Debian GNU/Linux) PHP/4.3.10-16 mod_ruby/1.2.4 Ruby/1.8.4(2005-10-29) #<#<Class: 0x40a7f818>:0x40a7f778>Content-Type: text/html Cache-Control: no-cache
2006 Apr 16
11
Best way to sort categories w/ pager
Ahoy, I made this pager, " def list @item_pages = Paginator.new self, Item.count, 10, @params[''page''] @items = Item.find :all, :conditions => "category_id = #{params[:condition]}", :limit => @item_pages.items_per_page, :offset => @item_pages.current.offset @categories = Category.find_all
2006 Jul 16
3
pagination over custom-sorted collections?
I have a little web app where we need to paginate collections of items. I''m trying to sort the collection and then pass it, sorted, to a Paginator, and still be able to paginate through the collection, across several pages, with the new sort order. The only thing I''m doing differently from the regular scaffolding approach is this: @order_pages = Paginator.new(self,
2006 Aug 04
4
DRY DRY DRY
Hello everyone! Ive been on rails for the last month or so and really enjoyed this framework. However its very hard to find documentation on how to do things right! For example every beginner after a while realizes that having similar CRUD actions in every controller and views for them is not DRY at all! Few days ago I found http://dereksivers.com/rails-shared-controller.html I quite like his
2005 Dec 19
6
custom find methods and pagination
i''ve got several methods in my models i use to find based on certain criteria...i''ve done this so the controller code is less cluttered, plus the DRY factor. example: class Foo < ActiveRecord::Base def find_by_something(something) find :all, :joins => ..., :conditions => ... end def find_by_something_else(something_else) find :all, :joins => ...,
2006 Apr 24
5
Custom pagination
I am trying to paginate objects from a has_many/:through relationship using Paginator. current_user.things returns the objects that I''d like to paginate. For testing, I tried to make it 1 item per page. I initialise the paginator as follows: @thing_pages = Paginator.new(self, current_user.things.count, 1, @params[''page'']) I don''t know how to obtain
2006 Apr 06
6
pagination question
i''ve figured out how to use the next and previous links with the paginator class but now i''m trying to figure out how to display all the page numbers in between. looking through the rails api, i found paginator.each() but i''m not sure how to use it, or if that''s even what i am looking for. also, is there a way to limit the amount of pages like some sites
2006 Apr 13
7
Complex SQL in paginate command?
Hi all, Is there a way to create pagination with a complex SQL, more complex than the :conditions option will support? I have two databases, houses and images. Houses has_many images, and each Image belongs_to house. I''m creating a search engine for the house records and I''d like to be able to filter out all the houses without any associated images. So far I''m
2006 Mar 13
0
Pagination attributes
I have created a pagination with my own conditions : @timesheets_pages = Paginator.new self, count, 30, @params[''page''] @timesheets = Timesheet.find :all,:include =>{:employee=>[:location,:division]}, :conditions => ["employees.location=? and employees.division=? and start_date>? and end_date < ?
2005 Dec 23
1
pagination problem
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
2004 Jul 13
2
Profile Problem with ldap backend
The Samba 3.0.5rc1 server is configured as a PDC. [global] # client code page = 866 # NetBIOS name of that comp netbios name = TOLTEC #Name of Domain workgroup = liin #Comment server string = Samba PDC %v #Interface where samba works interfaces = 10.0.0.4/24 127.0.0.1/24 bind interfaces only = yes hosts allow = 10.0.0. name resolve
2005 Dec 16
13
How to pass a collection to paginate?
There must be a better way to write this code: @project_pages, @projects= paginate :project, :per_page => 10, :conditions => ["account_id = ?", account] ?! If only I could pass the sub-collection account = ... @projects = account.project to paginate, instead of letting it extract it with a find :all + sql conditions Alain. -- Posted via
2006 Jan 25
4
Cannot :order when using :offset and :limit in find
Hello all. I am using the Paginate_with_ajax code as described on the wiki but I am running into the following problem. The following code will work fine and retrieved unsorted records in a hunky dory fashion: @componentlogs = Componentlog.find(:all, :conditions => [ "cl_compname like ?", @criteria ], :offset => offset, :limit => items_per_page ) However if I try and add an