“strive 3/11 ~ 3/18”
Use
Read
-
[rails] Common Rails Idioms that Kill Database Performance
- As you start doing more complex queries, it’s a good idea to run them through explain. Do it early and often.
-
[rails] rails boot process
- First Steps
- define load paths for dependencies (Bundle.setup)
- Load rails/all
- Load gem dependencies (Bundle.require)
- Define the application class
- Rails.application.initialize!
- Rails::Railtie
- Hooks to execute code when the console, runner, etc..
- Define custom configuration points
- Declare code to be executed during boot
- Lazy loading
- autoload, on_load
module ActiveRecord class Railtie < Rails::Railtie initializer 'active_record.logger' do ActiveSupport.on_load(:active_record) do self.logger ||= Rails.logger end end end end
- First Steps
-
[rails] Rails from Request to Response: Part 1 - Introduction
-
[rails] Rails from Request to Response: Part 2 - Routing
- rails/railties/lib/rails/engine.rb
- rails/actionpack/lib/action_dispatch/routing/route_set.rb
- rails/actionpack/lib/action_dispatch/journey/router.rb
- rails/actionpack/lib/action_dispatch/routing/mapper.rb
- rails/actionpack/lib/action_dispatch/routing/route_set.rb#dispatch
def dispatch(controller, action, env) controller.action(action).call(env) end
-
[rails] http://andrewberls.com/blog/post/rails-from-request-to-response-part-2--routing
- controller hierarchy
- YourController « ApplicationController < ActionController::Base < ActionController::Metal < AbstractController::Base
- rails/actionpack/lib/action_controller/metal.rb
- self.action
- rails/actionpack/lib/action_controller/metal/rack_delegation.rb
- dispatch
- rails/actionpack/lib/action_controller/metal.rb
- dispatch
- rails/actionpack/lib/abstract_controller/base.rb
- process
- controller hierarchy