[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Need explanation -> Passing 'id' in a form / link_to

Jean Nibee

6/8/2007 4:10:00 AM

Just need some more inside information...

Sample Code from the AWDWR book.

<%= link_to ( image_tag( product.image_url ),
{ :action => :add_to_cart, :id => product },
:method => :post,
:confirm => "Are you sure?" ) %>

Why is my :id => symbol using 'product' and not 'product.id'

Is the :id symbol 'dual purpose' and used as a key for an id param AND
it also infers that the FIELD to 'get' from the product object is named
'id'?

Thanks.

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

1 Answer

Jean Nibee

6/8/2007 2:18:00 PM

0

Sorry, posted here by mistake... reposting to rails forum.

Thanks.

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