Hey, anybody know how to set will_paginate to find only the :first match? def self.search(search, page) paginate :per_page => 15, :page => page, :conditions => [''title like ?'', "%#{search}%"], :order => ''thread_id DESC, created_at DESC'' end Thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
if you''re trying to paginate one at a time, set the :per_page to 1. On Mon, Jul 28, 2008 at 1:30 PM, Justin Roger < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hey, anybody know how to set will_paginate to find only the :first > match? > > def self.search(search, page) > paginate :per_page => 15, :page => page, > :conditions => [''title like ?'', "%#{search}%"], :order > => ''thread_id DESC, created_at DESC'' > end > > Thanks > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Brian Hogan wrote:> if you''re trying to paginate one at a time, set the :per_page to 1. > > On Mon, Jul 28, 2008 at 1:30 PM, Justin Roger <No, I have various rows with similar ID #s and I want to display only the :first one (most recently updated) in the group e.g. id | content |updated 1 | a | fri 1 | b | thur 2 | c | wed 2 | d | mon I want only 1|a|fri and 2|c|wed -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, I''ve just stumbled across ''will_paginate'', and I was wondering if anyone knows if I could use a ''find_by_sql''. The problem I''m facing is: I want to paginate, but I only want to list the maximum row in each group. Is this possible? Or is there any better way to do it? Thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
from will_paginate source code: # Example: # # @developers = Developer.paginate_by_sql [''select * from developers where salary > ?'', 80000], :page => params[:page], :per_page => 3 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
PP Junty wrote:> from will_paginate source code: > > # Example: > # > # @developers = Developer.paginate_by_sql [''select * from developers > where salary > ?'', 80000], :page => params[:page], :per_page => 3Great, looks promising. How would I find the most recent timestamp? ''where max(created_at'') ? Thanks!! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---