Skip to content

Instantly share code, notes, and snippets.

@elricstorm
Created December 29, 2010 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elricstorm/758668 to your computer and use it in GitHub Desktop.
Save elricstorm/758668 to your computer and use it in GitHub Desktop.
# 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
# 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment