Passing a dynamic class to translate


I have a single form that can be used for multiple models, in my view i
origionally had “Add a New #{@element.class}” how can i write a dynamic
i18n translate call?

I want to do something like

<%= t ‘removed_email_address@domain.invalid’%>

What is the best way to accomplish this functionality?


figured it out…

<% type_of_element = @element.class.to_s.downcase %>
<% add_element_to_translate =
[“model”, “add”, type_of_element
<%= t add_element_to_translate %>

hopes this helps someone else, if you figure out a better way let me