Displaying 3 results from an estimated 3 matches for "find_all_by_category_id".
2006 Apr 22
6
nOOb question: How to use find_all with form input data
Hello,
I''m having a problem utilizing the find_all method with a value from a
form. I keep getting the following error:
Mysql::Error: #42S22Unknown column ''category_id11'' in ''where clause'':
SELECT * FROM items WHERE (category_id11)
The controller seems to be getting the correct data, but my key and
value seem to be mashed together(it''s
2006 Jan 13
3
related drop down list / ajax
..."category",
:frequency => 0.25,
:update => "brand_id_container",
:url => { :action => :get_brands_for_category },
:with => "''category_id=''+value") %>
In my controller:
def get_brands_for_category
@brands = Brand.find_all_by_category_id(@params["category_id"])
end
Somehow it does not work. The related dropdown list does not change
contents. Does anybody have an idea why?
Regards,
Harm de Laat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/...
2006 Apr 13
2
Automatic finder
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?