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

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.

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

Thanks.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs