How do I make an image link tag using haml in Rails?

Ruby on-RailsHaml

Ruby on-Rails Problem Overview


I have something like this in application.html.haml:

#header
    = image_tag("header.jpg")

How do I make that link to www.google.com, for example?

Thanks

Ruby on-Rails Solutions


Solution 1 - Ruby on-Rails

I do it this way:

= link_to image_tag( 'header.jpg'), 'http://www.google.com'

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTonyView Question on Stackoverflow
Solution 1 - Ruby on-RailsgdelfinoView Answer on Stackoverflow