will_paginate

View: New views
2 Messages — Rating Filter:   Alert me  

will_paginate

by Richard Mcintyre-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


 paginate  :per_page => 15, :page => page,
                 :conditions => ['title like ?', "%#{search}%"], :order
=> 'requirement_id DESC, created_at DESC'

In my table:
requirement_id/created_at
1/5am
1/3am
2/5pm
2/3pm

How can I specify to only return the first row in each requirement_id
group? That is, I only want to paginate 1/3am and 2/3pm because 1/3am is
the first row in the group requirement_id = 1...

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@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: will_paginate

by Richard Mcintyre-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Justin To wrote:
>  paginate  :per_page => 15, :page => page,
>                  :conditions => ['title like ?', "%#{search}%"], :order
> => 'requirement_id DESC, created_at DESC'

I've been reading around and I think a solution may be to use the SQL
'limit 1', but where do I stick this in?
--
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@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

LightInTheBox - Buy quality products at wholesale price!