Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7054823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:40:27+00:00 2026-05-28T03:40:27+00:00

My app consists of two rails servers with mostly different concerns sitting behind a

  • 0

My app consists of two rails servers with mostly different concerns sitting behind a reverse proxy. Let’s call them Server1 and Server2. Occasionally, Server1 needs to render a link to a url on Server2. Is there a good way to use Rails route helpers for this? Specifically in Rails 2? I came up with this:

ActionController::Routing::Routes.draw do |map|

  # other routes omitted

  map.with_options(:host => 'server2.example.com') do |add|
    # create a named route for 'http://server2.example.com/thingies'
    add.server2_thingies         '/thingies',             :controller => 'fake'

    # create a named route for 'http://server2.example.com/thingies/combobulate'
    add.enhance_server2_thingies '/thingies/combobulate', :controller => 'fake'

    # create a named route for 'http://server2.example.com/mabobs/combobulate'
    add.enhance_server2_mabobs   '/mabobs/combobulate',   :controller => 'fake'

    # etc..
  end

end

So then I can use server2_thingies_url and such in my views. This works, but it makes me feel like a bad person because there is no FakeController and I certainly have no intention of routing requests to it. I considered making helper methods and placing them in app/controllers/application_controller.rb, but a colleague made the argument that it is best to keep all route helpers in routes.rb, so things like rake routes will be accurate, for instance. Is there a better way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:40:27+00:00Added an answer on May 28, 2026 at 3:40 am

    I think I’d make a counter-argument to your colleague: if you’re having to dirty up routes.rb with a “FakeController”, then your rake routes is still not going to be accurate. In fact, I’d say that this is exactly the kind of thing that a helper was meant to help: it’s taking logic that belongs purely in the view (link generation), and removing it from your view templates. Helpers are also easier to maintain and tweak.

    Another advantage to the helper style is that if and when it’s time to upgrade to Rails 3.x, the less hackish your routes.rb file is, the happier you will be – and that I can attest to from experience. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app which consists of several different assemblies, one of which holds
The app consists of two activities: first - a listview with links to HTML
I have a .NET 4 app which consists of the app and two class
My app is document-based, but the document consists of two folders, not one file.
The installer for my .NET app consists of two file MyApp.msi and setup.exe. I
I'm building an app which consists of different views which are closely related to
I have a rails app that consists of lots of accounts. Inside these accounts
I have two NSMutableArrays, collectables and collectableViews. My app consists of a character moving
I have a page that consists of two frames: one being a flash app,
I have an iphone app. The view is consists of two children: a tableview

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.