Select from the dropdown list to complete the text.
Assume that we are following standard Rails conventions and we have the following files
# config/routes.rb
Rails.application.routes.draw do
resources :foos, only: [:edit, :update]
end
# app/views/foos/edit.html.erb
<h1>Edit Foo</h1>
<%= form_with url: "#{foo_path(@foo)}?id=99", method: :patch do %>
<div>
<label>
ID <input type="text" name="id" value="77">
</label>
</div>
<div>
<input type="submit" value="Update">
</div>
<% end %>
Imagine we are editing Foo with ID=1, complete the FoosController#update action so that when we submit the form the puts statement prints the value of "99":
class FoosController < ActionController::Base
def edit
@foo = Foo.find(1)
end
def update
puts ( request.query_parameters[:id], request.params[:id], request.path_parameters[:id], request.request_parameters[:id], request.params[:foo][:id] )
end
end