title: how to pass parameter in render action in rails
body: <pre><code>def create
      @emppede = Emppede.new(params[:emppede])
  
      respond_to do |format|
        if @emppede.save
          format.html { redirect_to :action =&gt; :index, :id =&gt; @emppede.ad }
          format.json { render json: @emppede, status: :created, location: @emppede }
        else
  
          format.html { render action: "new", :id =&gt; @emppede.ad } *(....error)*
          format.json { render json: @emppede.errors, status: :unprocessable_entity }
        end
      end
    end
  </code></pre>
  
  <p>I have to pass id in new method. Here if the data is save properly then it goes to index method. But if not then it should go to new but with the params id. How could i pass the params through render action? Here i want to do but param id is not passed to new method. I highlighted that part by error.
  If i do </p>
  
  <pre><code> format.html { redirect_to :action =&gt; :new, :id =&gt; @emppede.ad }
  </code></pre>
  
  <p>Then it do not give errors message...</p>
  
  <p>I have to pass user id  to the new method so that i can pass it through the form and save.                                            </p>
  
  <pre><code>&lt;div id="employm" style="display:none"&gt;
  
  
      &lt;%= f.text_field :ad, :value=&gt; @id%&gt;
  
              &lt;/div&gt;
  </code></pre>
  
  <p>But when the form get error it render to new but here i have to send the
   id which is in  <code>@emppede.ad</code>. 
  How can i do  this?
  Since in order to enter in new method there should be id passed</p>
  
  <pre><code>redirect_to :action =&gt; :new, :id =&gt; @id
  </code></pre>