(the "Mark Ma" from Railsconf 07''?)
On 10-Dec-08, at 12:06 PM, Mark Ma wrote:>
> Hi guys:
> i have a question about Will_paginate .
>
> i have mutilple same type collections.
> for example .
>
> items_1 = Post.find(:all , :conditions =>{...}) # different
> condtions to
> get the items_1
>
> items_2 = Post.find(:all, :conditions ={...}) # diffenrt conditions to
> get the item_2
>
> items = items_1 | items_1
>
> then how i am supposed to do in next step ?
> please help
you can use the + ''method'' to add collections
items = items_1 + items_2
but might make more sense to merge the conditions into an OR?
items = Post.find(:all, :conditions => "(#{item_one_conditions}) OR
(#{item_2_conditions})")
Jodi
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---