Forum: Ruby link_to query mysql for list

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Aef7a7099755661a0823054a8952d43b?d=identicon&s=25 Jerry Jones (Guest)
on 2007-06-04 22:02
(Received via mailing list)
I have a web app that I want to make a link. I have a link_to that
will show the entire list of an inventory table, but I want another
link that will select only items of a certain name.
Here is my show all link
<%= link_to 'View Jewelry', {:controller => "inventory_item", :action
=> "list"} %>

I am unable to find a reference/example to show me how to do this. I
am new, please be gentle with me.  =)
72eb65fa089082d3bd8b38a5596ad331?d=identicon&s=25 Keynan Pratt (keynan)
on 2007-06-04 22:42
use the rails forum for ror questions
<%= link_to 'View Jewelry', {:controller => "inventory_item", :action =>
"list"} %>


<%= link_to 'View Jewelry', {:controller => "inventory_item", :action =>
"list", :name = 'some_name'} %>

and in the controller you need to say if there is a name provided find
:all, :conditions => ['name = ?', params[:name]]
8f6f95c4bd64d5f10dfddfdcd03c19d6?d=identicon&s=25 Rick Denatale (rdenatale)
on 2007-06-04 23:28
(Received via mailing list)
On 6/4/07, Keynan Pratt <> wrote:

> <%= link_to 'View Jewelry', {:controller => "inventory_item", :action =>
> "list", :name = 'some_name'} %>


<%= link_to 'View Jewelry', {:controller => "inventory_item", :action
=> "list", :name => 'some_name'} %>

and you can drop those brackets so:

<%= link_to 'View Jewelry', :controller => "inventory_item", :action
=> "list", :name => 'some_name' %>
Rick DeNatale

My blog on Ruby
This topic is locked and can not be replied to.