How to 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, not HTML, so I got stuck trying to figure out how to convert html.erb code to HAML. My problem is that I have the following code for the button:

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

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

+3
source share
3 answers

You tried:

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

After a couple of weeks, I went through one of my Rails applications and converted it to HAML, and it seems to me that all I needed to do was to fix such things.

+2
source

This = button_togenerates input <type=button>not a <button>.

0
source
-1

All Articles