Prev | Current Page 110 | Next

Brad Ediger

"Advanced Rails"

Active-
Support supplies a Symbol#to_proc method that returns just such a Proc; when called, it
invokes the specified method on its first argument.
RailTies | 75
TimeZone
Instances of TimeZone are value objects* representing a particular time zone (an offset from
UTC and a name). They are used to perform conversions between different time zones:
Time.now # => Thu Oct 25 00:10:52 -0500 2007
# UTC-05
TimeZone[-5].now # => Thu Oct 25 00:10:52 -0500 2007
TimeZone[-5].adjust(1.month.ago) # => Tue Sep 25 00:10:52 -0500 2007
RailTies
RailTies is the set of components that wire together ActiveRecord, ActionController,
and ActionView to form Rails. We will examine the two most important parts of
RailTies: how Rails is initialized and how requests are processed.
Rails Configuration
The Rails::Configuration class, defined in initializer.rb, holds the configuration
attributes that control Rails. It has several general Rails attributes defined as
attributes on the Configuration class, but there is a little cleverness in the framework
class stubs. The five class stubs (action_controller, action_mailer, action_view,
active_resource, and active_record) act as proxies to the class attributes of their
respective Base classes. In this way, the configuration statement:
config.action_controller.perform_caching = true
is the same as:
ActionController::Base.perform_caching = true
except with a unified configuration syntax.


Pages:
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122