Define routes for external links in rails
Public
19 Sep 10:10

In routes.rb

direct :blog do
  'http://blog.yourdomain.com/'
end

direct :api do
  Rails.env.production? ? ENV['API_URL'] : 'http://localhost:4000'
end

In views/controllers

blog_url # => 'http://blog.yourdomain.com/'
api_url # => 'http://localhost:4000'
https://guides.rubyonrails.org/routing.html#direct-routes 

Comments

Joe
aleksander
nice