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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:46:36+00:00 2026-06-16T05:46:36+00:00

I have two simple rake tasks — one that works and one that throws

  • 0

I have two simple rake tasks — one that works and one that throws the following error:

rake aborted!
undefined method `my_config_param' for #<Rails::Application::Configuration:0x007ffba6b2d320>

Here are the tasks:

task :with_env => :environment do
  Rails.application.config.my_config_param #works
end

task :without_env do
  Rails.application.config.my_config_param #fails
end

It’s pretty clear why :without_env fails and I can easily wrap my call to Rails.application.config in a begin/rescue statement. But I would like to know if there’s a way I can tell a priori if the environment is missing so I can work around this more elegantly. Is there such a way? I’ve been unable to find one….

  • 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-06-16T05:46:37+00:00Added an answer on June 16, 2026 at 5:46 am

    A colleague of mine noted that $rails_rake_task returns true if the rails env is loaded and false otherwise. This did the trick:

    Rails.application.config.my_config_param if $rails_rake_task

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

Sidebar

Related Questions

I have two apps. One is a very simple app that I built with
I have two simple views, one with a button that creates a view and
i have two simple models that have one-many relation public class X{ public int
I have two relatively simple codes. One main activity and one intent service. Main
I have two very simple, identical UITableViews in my app that are populated with
I have these two simple files that define a C++ class with a tryME
I have two functions that return simple strings. Both are registered. $.views.helpers({ parseDate: function
I have two simple margin styles defined, one based off the other. <Style x:Key=marginStyle
I have two simple NSMutableArray that consists of few objects. Some of these objects
I have two simple programs that use named pipes, here is the first: int

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.