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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:10:57+00:00 2026-05-25T23:10:57+00:00

I have been struggling with a problem for the past days in a Ruby

  • 0

I have been struggling with a problem for the past days in a Ruby on Rails App I’m currently working on. I have different countries and for each country we use different Amazon S3 buckets. Amazon S3 key credentials are stored as constants in config/environments/environment_name.rb(ex:demo.rb) There is no way for me to determine which country we are operating from the config file. I can determine which country we are operating from the controllers,models,views,etc but not from the config file. Is there a Ruby meta programming or some other kind of magic that I’m not aware of so that I want to say if we are working on UK as a country in the app, use UK’s bucket credentials or Germany as a country, use Germany’s bucket credentials? I can’t think of a way to pass parameters to environment files from the app itself. Thank you very much in advance for all your helps.

  • 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-25T23:10:57+00:00Added an answer on May 25, 2026 at 11:10 pm

    Rather than actually pass the configuration details to whichever S3 client you’re using at launch, you should probably select the relevant credentials for each request. Your config file can define them all in a hash like so:

    # config/s3.rb
    S3_BUCKETS => { 
      :us => 'our-files-us',
      :gb => 'our-files-gb',
      :tz => 'special-case'
    }
    

    Then you can select the credentials on request like so (in maybe your AppController):

    bucket_name = S3_BUCKETS[I18n.locale]
    # pass this info to your S3 client
    

    Make sense?

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

Sidebar

Related Questions

I have been struggling with a problem in the past few days. I really
I have been struggling with this problem for a few days now and I
I have been struggling with a nasty ANR problem with my app, which loads
So, for the past few days I have been struggling to understand how to
I have been struggling with a problem for a couple of days now with
I have been struggling with a problem in Google App Engine and Django and
I have been struggling with what I perceive to be a simple problem: Working
I have a problem that I have been struggling with for a few days
I have been struggling with this issue for the past couple days: I have
I have been struggling with a problem working in both html and php. in

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.