If your styling contains lots of tags and HTML elements, I would suggest putting them into partials:
<%= render :partial => @audit_log.description rescue nil %>
If you description
is created
, then it would render the file _created.html.erb
in the same folder as the current view
If it is deleted
, render _deleted.html.erb
automatically.
If description
is something else, which has no _something.html.erb
file, then nothing would be displayed (without rescue nil
, error will occurs)
======
If you want to render the partial in some different folder,
<%= render :partial => "some/where/#{@audit_log.description}" %>