Forum: Ruby on Rails Will_Paginate, with muliple same type collection

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
28b661b2d0fc64c95b02663db17e5add?d=identicon&s=25 Mark Ma (krammark)
on 2008-12-10 18:06
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
B09a3f6cdc4797532647d2d264b5df49?d=identicon&s=25 Jodi Showers (jshow)
on 2008-12-10 18:22
(Received via mailing list)
(the "Mark Ma" from Railsconf 07'?)

On 10-Dec-08, at 12:06 PM, Mark Ma wrote:
>
> 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
This topic is locked and can not be replied to.