Skip to content

Instantly share code, notes, and snippets.

@ng
Created June 19, 2009 00:39
Show Gist options
  • Save ng/132323 to your computer and use it in GitHub Desktop.
Save ng/132323 to your computer and use it in GitHub Desktop.
# we have
admin.resources :meals do |meal|
meal.resources :preparation_steps
meal.resources :preparation_tools, :collection => {:associate => :post},
:member => {:disassociate => :delete}
end
# i've added a "sort" method to the preparation_steps controller, and need
# to access /admin/meals/:meal_id/preparation_steps/:preparation_step_id/sort
# this is wrong but was the thing that would generate routes that were reasonable
admin.resources :meals do |meal|
meal.resources :preparation_steps do |step|
step.resource :sort, :controller => "preparation_tools", :action => "sort"
end
meal.resources :preparation_tools, :collection => {:associate => :post},
:member => {:disassociate => :delete}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment