search for: paginate_collect

Displaying 11 results from an estimated 11 matches for "paginate_collect".

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 Jul 31
9
Multiple Pagination
I have the following: def index begin @restaurant_pages, @restaurants = paginate :restaurants, :order => (params[ :sort ] || "name"), :per_page => 2 @cuisines = Cuisine.find_all rescue redirect_to :action => :index end end # sort by cuisine def
2006 Nov 08
0
Paginating a fetched resultset problems with next/previous
...ing this paginate function to paginate complex sql queries http://www.bigbold.com/snippets/posts/show/389, all seems to work fine but theres one thing, when i hit the next link it show nothing, i mean it only shows the first page, here is the code im using: #application.rb----------------- def paginate_collection(collection, options = {}) default_options = {:per_page => 10, :page => 1} options = default_options.merge options pages = Paginator.new self, collection.size, options[:per_page], options[:page] first = pages.current.offset last = [first + options[:per_page], collectio...
2007 May 10
5
Pagination has many through problems
I have searched for days for an example that demonstrates what i would like to do, and this morning i thought i''d worked it out, but no....here''s what i have: Controller ========== class ProfilesController < ApplicationController def friends current_user.profile.friends end def list_friends @profile_pages, @profiles = paginate( friends, :per_page => 10) end end
2007 Oct 15
3
NoMethodError
...ginate.rb and pagination.rb files are not in the same folder Here is my piece of code: def sample_method sql = "select * from customers where rownum < 100" collection = Sample::Models::Sa::Customer.find_by_sql(sql) options={:per_page => 10 , Page => 1} @pages, @customers = paginate_collection(collection,options) end Can any one point me where i am doing the mistake. Hope any one can help asap. Thanks & Regards joshi. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the...
2006 Feb 23
6
Search Forms with Pagination
...e and populate our paging object @filtered_machines = Machine.find(:all, :conditions => ["make LIKE ? AND model LIKE ? AND for_sale = 1 AND web_width != 0", sqlWildcard(@view.make), sqlWildcard(@view.model)]) @machine_pages, @machines = paginate_collection(@filtered_machines) end def getParam(name, default="") params.fetch("view", {}).fetch(name, default) end def sqlWildcard(value) value.blank? ? ''%'' : "%#{value}%" end Now, the list page is a full listing, and it has a filte...
2006 Apr 04
2
Pagination and Parent Conditions
Can I do any "fancy" conditionals when using the Pagination helper? The problem is that I want to be able to specify a conditional based on the criteria of a parent object. Here''s an example: Object A has_many Object B''s I want to paginate through 100 B''s but I *only* want it to return the ones who''s A.flag = true I poked around through the Wiki
2006 Mar 05
0
Pagination Question [Tagging: find_tagged_with]
...te the following query but no matter what I try I am unable to paginate it. In controller I have: q_webpages=Webpage.find_tagged_with(:any => params[:tag], :separator=>'','', :order=>''updated_at DESC'') @webpage_pages, @webpages = paginate_collection(:collection=>q_webpages) In my view I have: <%= link_to ''Previous page'', { :page => @webpage_pages.current.previous } if @webpage_pages.current.previous %> <%= link_to ''Next page'', { :page => @webpage_pages.current.next } i...
2006 Mar 18
3
paginate a collection
hi i want to paginate a collection found by complex sql query how can i do thanks -- Posted via http://www.ruby-forum.com/.
2007 Dec 10
4
Need help in Ajax Pagination
hi All, i wants to implement ajax pagination but i am facing a lot of problem , i found i lots of links on google but their is no explanation like what object we have to pass and condition can any body help me out in this concern pls i need your help as soon as possible thanks sachin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the
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