zachhale (owner)

Fork Of

Revisions

gist: 132492 Download_button fork
public
Public Clone URL: git://gist.github.com/132492.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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