Forum: Ruby on Rails question about RESTful resource routing

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ball, Donald A Jr (Library) (Guest)
on 2007-08-01 01:24
(Received via mailing list)
Hi guys. I've got a tree of Nodes which I'd like to edit via a RESTful
controller. The wrinkle at the moment is enabling manual ordering of the
nodes - that is to say, given a node, I want the user to be able to
reorder its children.


map.resources :nodes, :member=>{:order=>:put}


<ul id="list">
  <% @node.children.each do |child| %>
    <li id="child_<>"><%=h></li>
  <% end %>
<%= sortable_element('list', :url=>order_node_url(@node)) %>


def order
  # reorder the nodes

Unfortunately, dragging nodes in the list issues a POST request, which
rails rightfully rejects as improper for the order_node_url. I could fix
this by changing routes.rb to map :order to :post, but I believe that's
improper semantics.

What should I do in order to correct this? I would have thought the
order_node_url helper would automatically generate a PUT request.

- donald
This topic is locked and can not be replied to.