title: Rails - Validate model in another controller and persist errors
body: <p>I have two models <code>User</code> and <code>Want</code>. A <code>User</code> <code>has_many:</code> <code>Want</code>s.</p>
  
  <p>The <code>Want</code> model has a single property besides <code>user_id</code>, that's <code>name</code>.</p>
  
  <p>In the <code>edit</code> action view in the <code>UsersController</code> there are two forms. One POSTs (PUT) to the <code>UsersController</code> update method to update the user, another POSTs to the <code>WantsController</code> <code>create</code> action to add a new <code>Want</code> to the user's account.</p>
  
  <p>This is fine and I have it working, but...</p>
  
  <p>In the <code>create</code> action of the <code>WantsController</code> I redirect back to the <code>edit</code> action of the <code>UsersController</code> to show success or <code>Want</code> validation errors.</p>
  
  <p>The issue is that the edit action creates a new @want for the form and the validation errors are lost in the request.</p>
  
  <p>Check out the <code>create</code> action in the <code>UsersController</code>:</p>
  
  <pre><code>def create
      @want = current_user.wants.build(params[:want])
      if @want.save
        flash[:success] = "WANT created!"
        redirect_to user_account_path current_user.username
      else
        #flash[:validation] = @want.errors &lt;- I NEED THESE ERRORS FOR MY VIEW
        redirect_to user_account_path current_user.username
      end
    end
  </code></pre>
  
  <p>and the edit action of the <code>UsersController</code>:</p>
  
  <pre><code>def edit
    @want = @user.wants.build
    super
  end
  </code></pre>
  
  <p>Because the <code>WantsController</code> redirects I lose the errors in the <code>@want</code> instance variable. I can store the errors in the <code>flash</code> (as shown in the comment) but surely this is a complete misuse of the <code>flash</code>.</p>
  
  <p>So my question is, how can I persist those errors accross the action so I can render in my view the <code>Want</code> validation errors?</p>
  
  <p>Also, is this considered a validation of Rails conventions? Seems a bit overkill to create a whole new page so a user can add a single want with one string property!</p>
  
  <p>Thanks.</p>