Skip to content

Instantly share code, notes, and snippets.

@alexisbernard
Created January 6, 2010 22:12
Show Gist options
  • Save alexisbernard/270727 to your computer and use it in GitHub Desktop.
Save alexisbernard/270727 to your computer and use it in GitHub Desktop.
The root resource
# This enables the '/' resource:
# map.resources :knickers, :as => ''
#
# GET /blabla
# => KnickersController#show params = {:controller = 'knickers', :action => 'show, :id => 'blabla'}
module ActionController
module Resources
class Resource #:nodoc:
def path
@path ||= path_segment.blank? ? path_prefix.to_s : "#{path_prefix}/#{path_segment}"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment