Displaying 1 result from an estimated 1 matches for "my_fruit".
Did you mean:
my_fruits
2006 Mar 16
2
Arrays of Model Objects, Intersections, Object Identification... ?
...objects.
Let''s say I have to arrays of objects. Both are the same kinds of objects.
tomatoes = Fruit.find(:all, :conditions => [ ''tomato = ?'', true], :limit =>
10)
fruits = Fruit.find(:all, :limit => 10)
And I want to create an array of these objects called @my_fruits, but I
don''t want the set to contain any duplicates.
In the Ruby API documentation for arrays it shows you can use the | operator
to perform a union between two arrays, throwing out duplicates.
OK. That sounds good. That''s what I want.
@my_fruits = tomatoes | fruits
98% of th...