Alvaro Lourenço
Alvaro Lourenço

Reputation: 1341

How to use Haml haml_tag method with custom attributes?

I want to reproduce the haml code below by using the haml_tag method.

= %img { alt:'Hi' , src: 'hi.jpg' }

Can anyone help?

Upvotes: 1

Views: 747

Answers (1)

Alvaro Lourenço
Alvaro Lourenço

Reputation: 1341

Nah.. I've just realized that. There it goes:

- haml_tag :img, { alt:'Hi' , src: 'hi.jpg' }

Attention to the details of - instead of =. haml_tag method report directly to the haml model.

Easier than I thought. :)

Upvotes: 1

Related Questions