In this blog I am going to discuss difference between rails development and production mode. Often Rails app has so many different environments, each environment use different database which is mentioned in config/database.yml file, each environment also use different configuration files (eg:- config/environments/development.rb, config/environments/production.rb, etc ..).
The environment is simply a constant that is set when a Rails application is started and referenced often throughout the boot process and available to the application code. For instance, the constant defines which database configuration to use for connection and which environment initializer to execute (e.g. config/environments/development.rb) at boot time. .By default is in development mode.
In production mode all caching is by default turned on, also pointing to a memcached server. This features make load page faster. This features also has a disadvantage. If you make any change in coding, you can not see the changes only refresh the page or recall the action or method. You have to restart the server to reflect the changes.
In development mode Rails reloads all app classes and turns off caching to allow a faster development cycle.
In production mode Rails Asset Pipeline is by default is on, Prior to Rails 3.1 these features were added through third-party Ruby libraries such as Jammit and Sprockets. Rails 3.1 is integrated with Sprockets through Action Pack which depends on the sprockets gem, by default. Asset Pipeline, minify or compress your javascipt, css, images, scss files. It also adds the ability to write these assets in other languages such as CoffeeScript, Sass and ERB. It minimize the page load time.
When we run rails server on console, Rails app by default run with development mode. We can also run Rails app in production mode in your development machine by rails server -e 'production' command.
0 Comment(s)