Skip to content

Instantly share code, notes, and snippets.

@zachhale
Forked from ng/gist:132323
Created June 19, 2009 07:55
Show Gist options
  • Save zachhale/132492 to your computer and use it in GitHub Desktop.
Save zachhale/132492 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, :member => {:sort => :post}
# you'd want :collection => {:sort => :post} if you wanted /preparation_steps/sort
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