Http method for link_to_remote

Hi, I have two nested resources in routes.rb -


map.resources :subscriptions do |subscription|
subscription.resources :users
end

and I’m using link_to_remote to create a new “user” as follows -


<%= link_to_remote “New User”, {:url =>
new_subscription_user_url(@subscription), :method => “get”) %>

In the process of doing this I discovered that the default request
method for link_to_remote is POST, and so this didn’t work until I
added the :method => “get” parameter.

So it works fine now, but I’m just curious - what is the rationale for
making POST the default request method? In a non-ajax request, the GET
method is used, as required for the “new” action implied by my choice
of URL. But not for the ajax form of request. I’m puzzled about the
thinking behind this.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs