title: Rails: Pass parameters with render :action?
body: <p>I have a form that displays differently depending on the parameter it was called with.</p>
  
  <p>Ex.</p>
  
  <pre><code>testsite.local/users/new?type=client
  </code></pre>
  
  <p>So if <code>type</code> was <code>a</code> or <code>b</code>, the form would display different fields.</p>
  
  <p>My problem is when the form is filled out incorrectly, because if the user couldn't be saved corrently, it renders the form with the default error messages, but also without my parameter.</p>
  
  <pre><code>testsite.local/users/new
  </code></pre>
  
  <p>How can I call my <code>render</code> action and pass whatever this parameter is set to to it? So that I can still keep my built-in error messages about why the form couldn't be sumbitted properly AND have it be the right form?</p>
  
  <p>Here's my <code>create</code> action:</p>
  
  <pre><code>def create
     @user = User.new(params[:user])
     roles = params[:user][:assigned_roles]
     if @user.save
       update_user_roles(@user,roles)
       if current_user.is_admin_or_root?
         flash[:message] = "User \"#{@user.username}\" created."
         redirect_to users_path
       else
         flash[:message] = "Congrats! You're now registered!"
         redirect_to app_path
       end
     else
       render :action =&gt; 'new'
     end
   end
  </code></pre>