ruby on rails - What URL should I use to PUT an update? -
i have rails app picked has following command in "rake routes":
put /testclass/:id(.:format) testclass#update i want send put update testclass id 18445 , change finished false:
/18445&finished=false for example.
my understanding should able done http request in browser, example, can it? or need use ruby command? guidance?
you not need use ruby command access route make update.
basic html (you can edit action relevant route):
<form action='testclass/18445' method="post"> <input type="hidden" name="_method" value="put"> <input name="authenticity_token" value="<%= form_authenticity_token %>" type="hidden"> <input type="hidden" name="testclass[id]" value="18445" > <input type="hidden" name="testclass[finished]" value="false" > <input type="submit" value="update" > </form> notice 'post' there hidden input name '_method' , value 'put'. you're looking for. can send id through hidden input, same false value.
Comments
Post a Comment