title: detect if a form is submitted with ruby on rails?
body: <p>Is there a way to detect if a form is submitted? Im trying to set a class based on a custom validation something like below example, is that possible? </p>
  
  <pre><code>  .control-group{ :class =&gt; ("error" if form_is_submitted ) }
  </code></pre>
  
  <p>Now trying :</p>
  
  <pre><code>  .control-group{ :class =&gt; ("error" if params[:user][:profile_attributes][:gender] == nil) }
  </code></pre>
  
  <p>This fails if the form is not submitted because then the params are nill and throws an error </p>