title: How do I capture error messages from ActiveRecord validations?
body: <p>I'm creating a registration form using validation inside the User model such as </p>
  
  <pre><code> validates_confirmation_of :password, :message = "Passwords do not match"
   validates_uniqueness_of :email, :message = "Email in use"
  </code></pre>
  
  <p>and register looks like this</p>
  
  <pre><code>def register
  @user = User.new(params[:user])
    if @user.save
      redirect_to(:action =&gt; 'login')
    else
    end
  end
  </code></pre>
  
  <p>I just have no idea how to return these messages to the user once they trigger any of these validations.</p>
  
  <p>Any help would be greatly appreciated.</p>