I''m trying to link to action using an image. This is what I''m working with: <img src="<%= product.image_url %>" /> <%= button_to (''Details'', :action => ''details'', :id => product ) %> Is there a good way to make the *image* the clickable item? Any insights into button_to, and link_to that you want to share are appreciated. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 27 November 2006 14:05, Brandon wrote:> I''m trying to link to action using an image. This is what I''m working > with: > > <img src="<%= product.image_url %>" /> > <%= button_to (''Details'', :action => ''details'', :id => product ) %> > > Is there a good way to make the *image* the clickable item? Any > insights into button_to, and link_to that you want to share are > appreciated.<%= link_to image_tag(product.image_url), :action => ''details'', :id => product %> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks a lot! Is that basically a nested method? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 11/27/06, Brandon <brandonwright-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Thanks a lot! > > Is that basically a nested method?This is the same, but more readable. You pass the image as first parameter to the link_to method. The one posted before was simply omitting parenthesis: <%= link_to(image_tag(product.image_url), :action => ''details'', :id => product) %>> >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
which is better without parenthesis because it more legible, right? Rodrigo Alvarez Fernández wrote:> On 11/27/06, Brandon <brandonwright-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Thanks a lot! > > > > Is that basically a nested method? > > > This is the same, but more readable. You pass the image as first parameter > to the link_to method. The one posted before was simply omitting > parenthesis: > > <%= link_to(image_tag(product.image_url), :action => ''details'', :id => > product) %> > > > > > > > ------=_Part_56490_30357650.1164662276684 > Content-Type: text/html; charset=ISO-8859-1 > X-Google-AttachSize: 798 > > <br><br><div><span class="gmail_quote">On 11/27/06, <b class="gmail_sendername">Brandon</b> <<a href="mailto:brandonwright-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org">brandonwright-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> > <br>Thanks a lot!<br><br>Is that basically a nested method?</blockquote><div><br>This is the same, but more readable. You pass the image as first parameter to the link_to method. The one posted before was simply omitting parenthesis: > <br><br><%= link_to(image_tag(product.image_url), :action => ''details'', :id =><br>product) %> </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> > > ------=_Part_56490_30357650.1164662276684----~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---