Displaying 1 result from an estimated 1 matches for "render_username".
2006 Apr 08
5
If-Else Conditionals in Views
I find myself doing the following quite a lot:
<% if user %><%= user.name %><% else %>Anonymous<% end %>
I know that if I dont care about an else I can just do:
<%= user.name if user %>
Is there any simpler way to handle the else? This is a simple example
so it''s not really an issue.. but for more complicated tests this gets
quite tedious.
--
Posted