# Collect issue

**URL:** <https://www.ruby-forum.com/t/collect-issue/154717>\
**Category:** Rails\
**Created:** [December 3, 2008, 8:37am UTC](https://www.ruby-forum.com/t/collect-issue/154717 "2008-12-03T08:37:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![petan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c57346/32.png) [@petan](https://www.ruby-forum.com/u/petan)\
**Post date:** [December 3, 2008, 8:37am UTC](https://www.ruby-forum.com/t/collect-issue/154717/1 "2008-12-03T08:37:06Z")

</div>

Hi all,

I am filtering products

specs = Product.find(:all, :conditions =\> […], :order =\> “…”)  
@products = specs.collect { |spec| spec.??? }

And I would like to collect all of the product fields. I dont know what  
to use instead of my ???

And then I would like to show them to the user.

\<% @products.each do |p| %\>  
\<%= p.name %\> … \<%= p.price %\>  
\<% end %\>

Thx for help.  
P.

---

<div class="post-metadata">

**Author:** ![petan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c57346/32.png) [@petan](https://www.ruby-forum.com/u/petan)\
**Post date:** [December 3, 2008, 9:03am UTC](https://www.ruby-forum.com/t/collect-issue/154717/2 "2008-12-03T09:03:18Z")

</div>

On Dec 3, 7:37 am, Petan C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi all,
> 
> I am filtering products
> 
> specs = Product.find(:all, :conditions =\> […], :order =\> “…”)  
> @products = specs.collect { |spec| spec.??? }
> 
> And I would like to collect all of the product fields. I dont know what  
> to use instead of my ???

Maybe I’ve misunderstood, but why can’t you do  
@products = Product.find(:all, :conditions =\> […], :order =\>  
“…”)

Fred

>
