Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I convert button code from HTML to HAML?

I'm new to the Rails framework and my boss tells me that I need to code in HAML rather then HTML, so I'm stuck trying to figure out how to convert my html.erb to HAML code. My problem is that I have the following code for a button:

   <%= button_to 'Add to Cart', line_items_path(:product_id => product) %>

This button adds the product to a line item, can anyone suggest how to write the above code in HAML?

like image 239
Umer Hassam Avatar asked Dec 07 '25 09:12

Umer Hassam


1 Answers

Have you tried:

= button_to 'Add to Cart', line_items_path(:product_id => product)

I went through one of my Rails apps a couple weeks ago and converted it to HAML, and it seems to me that's all I needed to do to fix those sort of things.

like image 197
the Tin Man Avatar answered Dec 10 '25 00:12

the Tin Man