Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Rails Initialization Process and Init.rb

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 234
    Comment on it

    Today I am writing a blog about rails initialization process for beginners. Rails initialization process a vast topic. Here I am going through the use of config/environment.rb, config/environments/production.rb, config/environments/staging.rb, config/environments/development.rb files.

    When the server startup the framework initialize all the ruby code. For this we do not need to write endless xml file. we need to write some arbitrary code.

    Rails provides us the separate environment file for each environment in config/environments folder.

    If we want to configure any common configuration for each environment , then we will need to define those configuration into config/environment.rb

    Let's say, usually we do not use asset precompile in development environment. So we need to put config.assets.compile = false into config/environments/development.rb file

    But assets precompile is needed for production environment. So we have to put config.assets.compile = true into config/environments/production.rb file



    config.assets.compile = false


    config.assets.compile = true

    Order of the rails initialization process:-

    1. config/environment.rb

    2. config/environments/#{RAILS_ENV}.rb (eg:- development.rb, staging.rb, production.rb)

    3. plugin initialization

    4. gem initialization

    5. config/initializer/*.rb

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: