Re: Merging multiple AR result hashes into one for view loop

Marston A.
Fri, 23 Mar 2007 15:55:09 -0000

Bryan,

Ah ok, arrays make them much easier to deal with.  Thanks I''ll give
this a try.

On Mar 23, 4:21 pm, Bryan Duxbury
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:
> The has_many collections aren''t hashes, they''re arrays.
You can
> concatenate arrays with a + like so:
>
> for result in User.model1 + User.model2 + User.model3
> ...
> end
>
> If you''re worried about their sort order, you can sort them
manually
> with the Array#sort_by method.
>
> --
> Posted viahttp://www.ruby-forum.com/.