put

link_to update (without form)

自古美人都是妖i 提交于 2019-12-01 02:14:19
I want a link to update a resource, without using an HTML form. Routes : resources :users do resource :profile, :controller=>"profiles" resources :friends end Rake routes: user_friend GET /users/:user_id/friends/:id(.:format){:action=>"show", :controller=>"friends"} PUT /users/:user_id/friends/:id(.:format){:action=>"update", :controller=>"friends"} I want to use the put to update a friend by a simple link, something like this: <%=link_to "Add as friend", user_friend_path(current_user, :method=>'put')%> But as Rails meet that link he tries to go into the show action. The question is: what is

link_to update (without form)

独自空忆成欢 提交于 2019-11-30 21:42:37
问题 I want a link to update a resource, without using an HTML form. Routes : resources :users do resource :profile, :controller=>"profiles" resources :friends end Rake routes: user_friend GET /users/:user_id/friends/:id(.:format){:action=>"show", :controller=>"friends"} PUT /users/:user_id/friends/:id(.:format){:action=>"update", :controller=>"friends"} I want to use the put to update a friend by a simple link, something like this: <%=link_to "Add as friend", user_friend_path(current_user,

No HTTP resource error when doing PUT/POST [CORS issue - AngularJS + Web API 2]

大城市里の小女人 提交于 2019-11-30 21:22:32
There are so many questions in SO similar to this, but none have fixed my issue. I've have an angularjs website hosted at http://localhost:49595 and I'm calling a Web Api 2.1 service hosted at http://localhost:63019 . I've enabled CORS on the web api server in web.config. Requests for GET /buildings/1 and GET /buildings/?$top=10&$skip=1 work fine. When it comes to PUT, I get the following error: { "Message":"No HTTP resource was found that matches the request URI ' http://localhost:63019/buildings/1105 '.", "MessageDetail":"No action was found on the controller 'Building' that matches the

Can iOS devices send PUT requests to Rails apps?

断了今生、忘了曾经 提交于 2019-11-30 19:41:56
We've tried numerous times sending update PUT requests to our Rails server and we keep receiving a 404 "The page you were looking for does not exist" Our update method is very simple (practically generic rails). def update @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) format.html { redirect_to @user, notice: 'User was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @user.errors, status: :unprocessable_entity } end end end When I run CURL from the command line to

Rails Put vs Post

心已入冬 提交于 2019-11-30 16:43:22
问题 I have been reading up on the difference between put and post requests and I have some related questions as it pertains to rails: I would like to change one specific field in an already created row...should I use a put or a post request? For example are the following different? #Assume this is a put request def update @model=Model.find(x) @model.field="new_field" @model.save end #Assume this is a post request def update @model=Model.find(x) @model.field="new_field" @model.save end #What if I

Oracle PL/SQL UTL_FILE.PUT buffering

妖精的绣舞 提交于 2019-11-30 15:17:23
I'm writing a large file > 7MB from an Oracle stored procedure and the requirements are to have no line termination characters (no carriage return/line feed) at the end of each record. I've written a stored procedure using UTL_FILE.PUT and I'm following each call to UTL_FILE.PUT with a UTL_FILE.FFLUSH. This procedure errors with a write error once I get to the point where I've written more than the buffer size (set to max 32767) although I'm making the FFLUSH calls. The procedure works fine if I replace the PUT calls with PUT_LINE calls. Is it not possible to write more than the buffer size

PUT POST being idempotent (REST)

别来无恙 提交于 2019-11-30 15:07:28
问题 I don't quite get how the HTTP verbs are defined as idempotent. All I've read is GET and PUT is idempotent. POST is not idempotent. But you could create a REST API using POST that doesn't change anything (in the database for example), or create a REST API for PUT that changes every time it is called. Sure, that probably is the wrong way to do things but if it can be done, why is PUT labeled as idempotent (or POST as not) when it is up to the implementation? I'm not challenging this idea, I'm

How are PUT parameters passed to a page?

落爺英雄遲暮 提交于 2019-11-30 14:35:01
问题 I can't find a precise answer on that question : Are parameters which are sent by PUT passed in the URL, or in the HTTP header ? I think it's the HTTP header, but when I submit my form with the PUT method, it appends the parameters to the URL ! 回答1: Are parameters which are sent by PUT passed in the URL, or in the HTTP header ? Not the headers. It's the same as POST - either the URL or the body of the request. The only difference is the HTTP verb being used and of course the semantics that

PUT POST being idempotent (REST)

*爱你&永不变心* 提交于 2019-11-30 13:44:35
I don't quite get how the HTTP verbs are defined as idempotent. All I've read is GET and PUT is idempotent. POST is not idempotent. But you could create a REST API using POST that doesn't change anything (in the database for example), or create a REST API for PUT that changes every time it is called. Sure, that probably is the wrong way to do things but if it can be done, why is PUT labeled as idempotent (or POST as not) when it is up to the implementation? I'm not challenging this idea, I'm probably missing something and I ask to clear my understanding. EDIT: I guess one way to put my

Problems with a POST/PUT Json RESTful request Grails

流过昼夜 提交于 2019-11-30 13:03:16
问题 Hi I have a grails restful code. I do perfect a Json get and delete request. My problem is: I want to do a Put or post request with json but if I use a program to do that It has an error and I cant do it! Here my code: One class: package catalogo.json class Catalogo { String nombre String descripcion String url Set <Parametros>parametros =[] static hasMany = [parametros:Parametros] int numeroParametros = parametros.size() } And other class: package catalogo.json class Parametros { String