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 6007335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:39:58+00:00 2026-05-23T01:39:58+00:00

I come from a PHP and Python/GAE background and am new to RoR. Typically

  • 0

I come from a PHP and Python/GAE background and am new to RoR. Typically I’d have a global variable set up containing my unsecure and secure webpage’s url, for use when templating. For example, if I want to link to an image, rather than saying img src=”www.mysite.com/images/img1.png” I can use img src=”{{ unsecure_url }}images/img1.png”.

I’m thinking the best way to do this in RoR is to add the following to my application_helper. Is that valid?

def unsecure_url
  "http://localhost:3000/"
end

def secure_url
  "https://localhost:3000/"
end

And how can I switch between localhost and production, depending on whether I’m in a local environment or not?

  • 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-23T01:39:59+00:00Added an answer on May 23, 2026 at 1:39 am

    If you use the pre-existing helpers, they should generate relative links for the current protocol and domain.

    Take a look at link_to, and image_tag.

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

Sidebar

Related Questions

I come from a PHP based background and my new years resolution was to
I am very new to xcode & Objective-C (having come from PHP) i have
I am new to python, I come here from the land of PHP. I
i am new to webforms and come from a php background. when creating complex
I come from a PHP/Javascript background where things are stored in a variable directly
I come from PHP background and am used to doing var_dump , echo and
I come from a php background and in php, there is an array_size() function
I come from a PHP background and I'm just getting my teeth into some
I'm not too used to ORM mapping, having come from a PHP background. I'm
I come from a mainly PHP background and make good use of the Apache

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.