Chapter 1 - Rails Environments Flashcards
Gemfile.lock
Bundler calculates the dependency tree for your application and stores the results in a file named Gemfile.lock. From that point on, Bundler will only load specific versions of gems that you are using at the moment that the Gemfile was locked.`
There are three files involved in setting up the entire Rails stack:
config/ boot.rb Sets up Bundler and load paths.
config/ application.rb Loads Rails gems and gems for the specified Rails.env and configures the application.
config/ environment.rb Runs all initializers.
inflections.rb
The default inflections for pluralization and singularization of uncountable words are kept in an interesting file inside the Active Support gem, named inflections.rb.
session_store.rb
As of Rails 4, session cookies are encrypted by default using the new encrypted cookie store. The session_store.rb initializer configures the session store of the application by setting its session store type and key.
Rails.application.config.session_store :cookie_store,
key: ‘_example_session’
session_store.rb
As of Rails 4, session cookies are encrypted by default using the new encrypted cookie store. The session_store.rb initializer configures the session store of the application by setting its session store type and key.
Rails.application.config.session_store :cookie_store,
key: ‘_example_session’
Setup Pry
console do # This block is called only when running console, # so we can safely require pry here. require "pry" config.console = Pry end
Spring
As of version 4.1, Rails ships with an application preloader named Spring. 9 In doing so, during development, your application will remain running in the background. This speeds up development by eliminating the need to boot up Rails every time you execute tests or run a rake task.
https:// github.com/ rails/ spring
Spring
As of version 4.1, Rails ships with an application preloader named Spring. 9 In doing so, during development, your application will remain running in the background. This speeds up development by eliminating the need to boot up Rails every time you execute tests or run a rake task.
https:// github.com/ rails/ spring
Eager Load
To speed up the boot time of starting a Rails server during development, code is no longer eager loaded. This behavior is governed by the
config.eager_load setting:
# Do not eager load code on boot. config.eager_load = false
In your production environment, you will want this set to true, as it copies most of your application in memory. This provides a performance increase to web servers that copy on write, such as Unicorn.