Hi everyone, I’m trying to make my first rails app which is a product
catalog. I have finished an administrative back-end and added data but
am currently having problems figuring out how to list the products in
the front end. Each product belongs to a section and type (ie: the
product “western shirt” would be in section “vintage” and type
“shirts”). I also gave the product model a gender type which is just
a hard coded inclusion list. The product to section/typ mode
relationship is belongs_to and :has many. I would like to show lists of
product “types” in a specific section for males and females, basically
like the folowing…
Section - Vintage
Male Types
Jackets -> Product 1, Product 2, Product 3
Jeans
Shirts
Female Types
Jackets
Jeans
Shirts
Currently, I’m able to show selected products in a section by gender
using the following in my store controller…
def show_section
@sections = Section.find(:all)
@section = Section.find_by_permalink(params[:id])
@products = Product.find(:first)
@male_products =
@section.products.find_all_by_gender([‘male’,‘unisex’])
@female_products =
@section.products.find_all_by_gender([‘female’,‘unisex’])
end
Can anyone point me in the right direction to get my view working in the
way I’ve described above? Any help would be greatly appreciated. I
have a bad feeling I may have been doing this all backwards.