Skip to content

Instantly share code, notes, and snippets.

@palkan
Last active February 13, 2019 01:19
Show Gist options
  • Save palkan/73f6e2c203c26c46574ef5832a446643 to your computer and use it in GitHub Desktop.
Save palkan/73f6e2c203c26c46574ef5832a446643 to your computer and use it in GitHub Desktop.
# config/application.rb
module MyCoolApp
class Application < Rails::Application
# ...
# Load routes from config/routes folder
# NOTE: Order of route matters! It's better to not have routing conflicts, but if you have them,
# make sure to load routes in the correct order.
# In our case we must prepend all separate routes before main routes.rb
Dir[Rails.root.join('config/routes/**/*.rb')].each { |f| config.paths["config/routes.rb"].unshift(f) }
# ...
end
end
# config/routes/callbacks.rb
MyCoolApp::Application.routes.draw do
# We also add subdomain constraint here
scope module: :callbacks, as: :callbacks, constraints: { subdomain: 'callbacks' } do
namespace :"third-party" do
resource :mail, only: [] do
post :notify
end
resource :web_hooks, only: [] do
post :verify
end
resource :payment, only: [] do
post :status
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment