Hi,
1st of all, my english is bad, and i’m new to RoR, so accept my
apologies from start.
I need two combo-boxes populated from two tables that will act as
filters for a product list. I’ve already read some examples and
tutorials, but it seems that I’m still stuck in the problem.
Files :
db/migrate/001_create_products.rb http://pastie.textmate.org/60449
db/migrate/002_create_parent_categories.rb
http://pastie.textmate.org/60452
db/migrate/003_create_categories.rb http://pastie.textmate.org/60453
app/controllers/admin_product_controller.rb
http://pastie.textmate.org/60456
app/views/admin_product/list.rhtml http://pastie.textmate.org/60458
the Controller for Products is called admin_product. the list method
takes all the products from the db_table called products and displays
them.
the trick is to have two combo-boxes, 1st populated with the
parent_category_name from the parent_categories table, and the second
populated with category_name from the categories table. the default
value in the combo-boxes should be “- Select a parent category -” and "
- Select a category -".
When a option from the combo boxes is selected, the page should reload,
displaying only the products that have the parent_category_id or the
category_id that was selected. and also, if a parent_category is
selected, the second combo box shoul display only the categories with
the parent_category_id that was selected in the first combo-box. I think
that the ajax example with state/county/city it’s not suitable, beacause
the products list might be paginated. If I’m wrong please correct me.
Thank you for spendig this much time reading all this stuff and also for
any hints and code snippets that I can use.
All my respect,
Cezar