Last active
October 9, 2016 14:30
-
-
Save sergio1990/d8ef79aea2c3f91543f4167f6b78ca6a 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
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 |
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
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