title: Access old get parameters in URL after a post request
body: <p>I have a form in RoR with a controller action that looks up a record via the get parameter. </p>
  
  <pre><code>def respond 
    if request.post? 
      # Submit logic here...
  
      # cannot lookup this way to fill the form out again 
      # @current_message = Saved_message.find_by_id(params[:msg_id])
    elsif request.get? 
      @current_message = Saved_message.find_by_id(params[:msg_id])
    end
  end
  </code></pre>
  
  <p>I can't use the <code>params[:msg_id]</code> to lookup the message again because it's a post request and I don't resend the get parameters. However, the get parameters remain in the url such as <code>.../messages/respond?msg_id=2</code>. I can get around this by passing in a hidden field with a different parameter name like <code>&lt;%= form.hidden_field :msg_id_2, value: params[:msg_id] %&gt;</code>. Then I can lookup the <code>@current_message</code> via the <code>params[:msg_id_2]</code>. However, I don't like this solution. Any advice to access the now inaccessible get parameter? </p>