Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is difference between application.rb and environment.rb in Ruby on Rails?

I am new to Rails and I have good knowledge of ASP.net. In ASP.net web applications I have one web.config to do all my settings, but in Rails there are several config files and I would like to know now, what are the differences between them and what is the purpose of these files are.

like image 528
pramodtech Avatar asked Jan 30 '13 10:01

pramodtech


2 Answers

Basically the different config files build together the web.config as you know it from ASP.net.

environment.rb

Rails has different run-levels, like ASP.net has it's environments too. In the environment.rb file you configure these run-levels. For example, you could use it to have some special settings for your development stage, which are usefull for debugging.

application.rb

The purpose of this file is to configure things for the whole application like encoding.

You can find some more information in the guide, like it was mentioned by davids.

like image 186
Robin Avatar answered Oct 12 '22 01:10

Robin


From the guides:

config/environment.rb

This file is the common file required by config.ru (rails server) and Passenger. This is where these two ways to run the server meet; everything before this point has been Rack and Rails setup.

This file begins with requiring config/application.rb.

config/application.rb

This file requires config/boot.rb, but only if it hasn’t been required before, which would be the case in rails server but wouldn’t be the case with Passenger.

Then the fun begins!

like image 29
davids Avatar answered Oct 12 '22 01:10

davids