[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

link_to query mysql for list

Jerry Jones

6/4/2007 8:02:00 PM

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. =)

2 Answers

Keynan Pratt

6/4/2007 8:42:00 PM

0

use the rails forum for ror questions
<%= link_to 'View Jewelry', {:controller => "inventory_item", :action =>
"list"} %>

becomes

<%= 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]]

--
Posted via http://www.ruby-....

Rick DeNatale

6/4/2007 9:27:00 PM

0

On 6/4/07, Keynan Pratt <keynan@howe.textdrive.com> wrote:

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

actually

<%= 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
http://talklikeaduck.denh...