This is my code and it is loaded in a helper-class
output += '<button class="del_account" param-del="{account.id}">delete</button>'
When I render this to html, account.id is just converted to a string. And not the ‘id’ that I need. How can I solve this? Because this isn’t working either.
output += '<button class="del_account" param-del="#{account.id}">delete</button>'
or this
output += '<button class="del_account" param-del="' +account.id +'">delete</button>'
thanks for your help.
You could use the Rails helper method
content_tag(documentation) which makes things a bit cleaner and more readable.Also, technically ‘param-del’ makes your HTML invalid – your custom attributes should begin with ‘data-‘, so updating above would become: