Skip to content

Instantly share code, notes, and snippets.

@sergio1990
Last active October 9, 2016 14:30
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 sergio1990/d8ef79aea2c3f91543f4167f6b78ca6a to your computer and use it in GitHub Desktop.
Save sergio1990/d8ef79aea2c3f91543f4167f6b78ca6a to your computer and use it in GitHub Desktop.
module WithDefaultScopeExtension
def with_default_scope(scope_options, &block)
normalized_scope_options = Array(scope_options)
scope(*normalized_scope_options) do
instance_exec(&block)
end
end
end
ActionDispatch::Routing::Mapper.send :include, WithDefaultScopeExtension
Rails.application.routes.default_scope = [':custom_prefix', custom_prefix: /app/]
Rails.application.routes.draw do
# routes are here
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment