On Nov 7, 2007 10:41 AM, Wired Wizard
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> 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"}
@product = Product.find_by_sql["SELECT * FROM products WHERE
category_id = ?", params[:id]]
--
gavri
http://purl.oclc.org/NET/gavri
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---