Creating staging and other environments in Rails

Ruby on Rails come with three environments by default – development, testing and production. But sooner or later one has a need for staging environment. And don’t get me wrong, you can (or should?) use the production settings there, but if you run it locally or on the same server as production, chances are you need a different database. And while you are at it, it may be handy to allow logging to console or change any other of Rails settings for that matter. In fact you can create as many other environments as you want and since it’s really easy I encourage you to do so.

To create a new environment you need to create:

  • a new config/environments/YOUR_ENVIRONMENT.rb file
  • a new database configuration entry in config/database.yml if your application uses database
  • a new secret key base entry in config/secrets.yml for apps on Rails 4.1 and higher

Creating staging and other environments in Rails #ruby #rubydeveloper #rubyonrails #environments https://rubyonrails.ba/single/creating-staging-and-other-environments-in-rails

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles