Forum: Ruby on Rails collect issue

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.
Petan C. (Guest)
on 2008-12-03 09:37
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.
Frederick C. (Guest)
on 2008-12-03 10:03
(Received via mailing list)
On Dec 3, 7:37 am, Petan C. <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
>
This topic is locked and can not be replied to.