Created
June 15, 2011 18:02
-
-
Save samuelkadolph/1027685 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resources :things, :glob_id => true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActionDispatch::Routing::Mapper::Resources | |
RESOURCE_OPTIONS << :glob_id | |
class Resource | |
def member_scope | |
"#{path}/#{glob_segment_prefix}id" | |
end | |
def nested_scope | |
"#{path}/#{glob_segment_prefix}#{singular}_id" | |
end | |
private | |
def glob_segment_prefix | |
@options[:glob_id] ? "*" : ":" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment