I have an AuditLog with things like id, action, type, description…
What I’d like to do in the view is something like:
case description
when "created"
<li>created styling</li>
when "deleted"
<li>deleted styling</li>
else
<li>error</li>
end
Trying to learn how to do this in a view and the correct syntax, which the resources I found on Google don’t specify.
If your styling contains lots of tags and HTML elements, I would suggest putting them into partials:
If you
descriptioniscreated, then it would render the file_created.html.erbin the same folder as the current viewIf it is
deleted, render_deleted.html.erbautomatically.If
descriptionis something else, which has no_something.html.erbfile, then nothing would be displayed (withoutrescue nil, error will occurs)======
If you want to render the partial in some different folder,