HTTP request - Ruby on Rails -
i took on else's rails project , have question http requests.
it seems should able pass parameters through http requests, i'm unsure how. example: rake routes
shows
put /auction2s/:id(.:format) auction2s#update
which seems correspond function
# put /auction2s/1 # put /auction2s/1.json def update @auction2 = auction2.find(params[:id]) print "hello world" respond_to |format| if @auction2.update_attributes(params[:auction2]) format.html { redirect_to @auction2, notice: 'auction2 updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @auction2.errors, status: :unprocessable_entity } end end end
but can't figure out url need pass to, instance, change
id=18445&done=true
into function.
any thoughts? function structured right? need pass request in ruby format, not through browser or ajax (which i'm trying)?
you should have form action. in location -> app/views/auction1s/edit.html.erb
. edit.html.haml
if using haml template engine. form rendered in view , user input sent parameters action on submit of form.
Comments
Post a Comment