Last active
June 19, 2019 09:20
-
-
Save ruhenheim/8b79e93f176b0d921275adf082664975 to your computer and use it in GitHub Desktop.
Railsルーティング定義アレコレ
This file contains hidden or 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.draw do | |
scope '(:locale)', locale: /#{I18n.available_locales.map(&:to_s).join('|')}/ do | |
# ==================================== | |
# For API | |
# ==================================== | |
namespace :api do | |
namespace :v1 do | |
resources :companies, path: 'cm/', only: [] do | |
resources :provinces, only: :index, defaults: { format: 'json' } | |
end | |
end | |
end | |
# ==================================== | |
# For users | |
# ==================================== | |
root to: 'top#index' | |
... | |
# ==================================== | |
# For agents | |
# ==================================== | |
namespace :agent do | |
root to: 'dashboard#index' | |
... | |
end | |
match "/", to: "application#render_404", via: [:head, :post, :patch, :put, :delete, :options] | |
match "*path", to: "application#render_404", via: [:get, :head, :post, :patch, :put, :delete, :options] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment