Skip to content

Instantly share code, notes, and snippets.

@samuelkadolph
Created June 15, 2011 18:02
Show Gist options
  • Save samuelkadolph/1027685 to your computer and use it in GitHub Desktop.
Save samuelkadolph/1027685 to your computer and use it in GitHub Desktop.
resources :things, :glob_id => true
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