.slim extension vs .erb extension

I came across this slim code in rails…

tr
td #{ admin_category.name }
td = link_to ‘Edit’, edit_admin_category_path(admin_category)
td = link_to ‘Delete’, admin_category_path(admin_category), method: :delete

What would this translate to in an ERB file?

tr is table row, td is table data the #{ admin_… } is:


the = translates to <%=
Slim knows when to terminate the tags properly, so will put %> and the s and in automatically. I believe you can take a chunk of slim and translate it to erb somewhere on the web. search for ‘slim to erb’
1 Like