This is probably a basic question, but I was wondering if / how it's
possible to run a find on an existing hash.

For instance:

1. I need to pull all products in the database for a simple list:
@products = Products.find(:all)

2. At a separate portion of the page, I want to display products that
are in, say, category 5.

>From scratch, I could run...
@new_products = Products.find(:all, :conditions => {:category_id => 5})

Although, I thought you could also do

@new_products = @products.find(:all, :conditions => {:category_id = 2})

My query has been returning a wrong number of arguments (2 for 1), so I
wasn't sure if I was headed on the right track.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to