public
Last active

  • Download Gist
old_routes.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# OLD Routes.rb file - showing changes
 
#Rails.application.routes.draw do |map|
Rails.application.routes.draw do
 
mount_at = Cheese::Engine.config.mount_at
 
match mount_at => 'cheese/widgets#index'
 
# map.resources :widgets, :only => [ :index, :show ],
resources :widgets, :only => [ :index, :show ],
:controller => "cheese/widgets",
#:path_prefix => mount_at, (deprecated)
#:name_prefix => "cheese_" (deprecated)
:as => "cheese_"
 
end
routes.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
# corrected routes file
 
Rails.application.routes.draw do
 
mount_at = Cheese::Engine.config.mount_at
 
match mount_at => 'cheese/widgets#index'
 
scope mount_at do
 
resources :widgets, :only => [ :index, :show ],
:controller => "cheese/widgets",
:as => "cheese_widgets"
 
end
 
end
 
# this produces:
 
# cheese /cheese(.:format)
# cheese_widgets GET /cheese/widgets(.:format)
# cheese_widget GET /cheese/widgets/:id(.:format)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.