I’m writing a generator that adds a few files that my server will use. I’d also like to add a line to the environment.rb file. Can this be done with a generator or should I be using an app template?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Rather than modifying environment.rb, check out what you can do with Rails initializers. Basically, you’re just going to create a new Ruby .rb file within config/initializers and keep your configuration loading code in there. If you need per-environment configuration, it’s best to create another (usually YAML) file within config/ that will store the per-environment configuration variables and load that YAML in your initializer.