Question

I have a widget that has many links. In the routes file:

map.resources :widgets, :has_many => [:links]

I want to add a "sort" action to links. What do I need to add to the routes file, so I can write sort_widget_links_path(widget)

Was it helpful?

Solution

You can define it using a block:

map.resources :widgets do |widget|
  widget.resources :links, :member => {:sort => :get}
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top