I have a decorator in my rails view.
h.content_tag(:p, class:["buttons"]) do
h.mail_to object.email, class:"button is-small" do |button|
h.content_tag(:span, class:["icon","is-small"]) do
"<i class='far fa-envelope'></i>".html_safe
end +
h.content_tag(:span, "Mail")
end
h.link_to admin_participant_path(object), class:"button is-small" do |button|
h.content_tag(:span, class:["icon","is-small"]) do
"<i class='far fa-user'></i>".html_safe
end +
h.content_tag(:span, "Show")
end
end
In my view I have only the latest part rendered, so basically the show. Not the email.
If I add a '+' to contact the mail_to and link_to helpers I have an error.
How can I concat them?
I think the right answer would be to use "capture" and "concat" Rails helpers.
Look at this article: https://thepugautomatic.com/2013/06/helpers/
It is old but should still is valid in Rails recent versions.