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

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -