I want to be able to render a variable on an html page such that an error won’t be thrown even when a variable, which may be a structre, doesn’t exist or nil. How to create a helper method?
<%= render_variable_safe(my_var1) %>
<%= render_variable_safe(my_var2.field1.field2) %>
<%= render_variable_safe(my_var3.field1.field2.field3) %>
None of these should thrown an exception if a variable or field doesn’t exist or nil.