Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はルートルールを持っています:
match '*path' => redirect("/some_scope/%{path}")
ただし、現在のパスが次の場所から始まらない場合にのみ、これを適用する必要があります/some_scope/
/some_scope/
これが私の解決策です:
DEFAULT_PATH_SCOPE = "/my_scope" default_scope_constraint = ->(request) do !request.path.starts_with?(DEFAULT_PATH_SCOPE) end constraints(default_scope_constraint) do match '*path' => redirect("#{DEFAULT_PATH_SCOPE}/%{path}") end