yes that worked perfectly! thanks.
What’s an Intel chip doing in a Mac? A whole lor more that it’s ever
done in a PC.
My Digital Life - http://scottwalter.com/blog
Pro:Blog - http://scottwalter.com/problog
----- Original Message ----
From: Alex W. [email protected]
To: [email protected]
Sent: Thursday, April 13, 2006 12:23:51 AM
Subject: Re: [Rails] Automatic finder
First of all the find_by_xxx methods just return 1 record. I
think the find_all_by_xxx is what you need.
Does this work?
chunks = Chunk.find_all_by_category_id(2)
I’m not entirely sure the dynamic finders work with associations, but
since “category_id” is a direct property of the model it shouldn’t have
a problem with it. Might make a nice patch though.
-Alex
Scott W. wrote: It looks rails
automatically creates a “finder” method on models that have a
“belongs_to”. So I tried this in the console:
c = Category.find(2)
chunks = Chunk.find_by_category(c)
chunks is always returned as an empty array. When I know have some
chunks with a category_id of 2.
Should the find_by_category do what I think it should be doing or am I
completely off base?
thanks, cott.
What’s an Intel chip doing in a Mac? A whole lor more that it’s ever
done in a PC.
My Digital Life - http://scottwalter.com/blog
Pro:Blog - http://scottwalter.com/problog
_______________________________________________ Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails