Select where url param

Im new to Ruby on Rails and I’m sure this is Simple Simon question.

Trying to do a sql select where based on a url param

This works fine and displays what I want but I want to change the 1

to a url param

    def list
@product = product.find_by_sql ["SELECT * FROM products WHERE

category_id = 1"]
end

Parameters: {“id”=>“1”}

On Nov 7, 2007 10:41 AM, Wired W. [email protected]
wrote:

category_id = 1"]
end

Parameters: {“id”=>“1”}

@product = Product.find_by_sql[“SELECT * FROM products WHERE
category_id = ?”, params[:id]]


gavri