I´m following the Depot tutorial in Agile Web D. with Rails.
I need some help to display products thats in one specific category.
mysql> select * from products where category = “jackets” does what I
want, but I´m not sure how to make a list and display it in rails?
This code displays every product with some of its fields, but I want
it to only display the products that has the field category set to
“jacket”
<% for product in @products -%>
<%= product.brand %> <%= h(product.title) %>
<%= product.description %>
I would be very grateful it anyone could help me out with some
examples or point me in the right direction.
And the same code you have in your view will display just the products
you
want.
HTH
Juanjo
----- Original Message -----
From: “Martin S.” [email protected]
To: [email protected]
Sent: Monday, March 06, 2006 11:07 AM
Subject: [Rails] Rails MySQL query
Hi,
I´m following the Depot tutorial in Agile Web D. with Rails.
I need some help to display products thats in one specific category.
mysql> select * from products where category = “jackets” does what I
want, but I´m not sure how to make a list and display it in rails?
This code displays every product with some of its fields, but I want
it to only display the products that has the field category set to
“jacket”
<% for product in @products -%>
<%= product.brand %> <%= h(product.title) %>
<%= product.description %>
I would be very grateful it anyone could help me out with some
examples or point me in the right direction.