views:

21

answers:

1

I have some text/images that I only want to display in the normal state of a form -- that is, it hasn't been submitted, yet. If the user submitted the form, and it is returned to the browser with errors, I'd like to display something else. Currently, I'm using:

<% if [email protected]? -%>
    # Leaving this area blank.
<% else -%>
    # Inserting something here
<% end -%>

But this seems a bit heavy and there has to be a simpler way.

This is probable really simple to do, but I can't find anything about it -- though, I'm probably not phrasing the question right.

Thanks for the help!

A: 

I can't imagine something completely different right now. But why don't you use only the if statement when you only need one branch of it?

<% if @users.errors.empty? %>
  # Inserting something here
<% end %>
Koraktor