diff options
author | paulccarey <paulccarey@gmail.com> | 2010-07-29 15:34:59 +0100 |
---|---|---|
committer | paulccarey <paulccarey@gmail.com> | 2010-07-29 15:34:59 +0100 |
commit | 2b2ee222f3012a29c9db95d357a30029100b226b (patch) | |
tree | 6359b3994e1b4d77311c2fa039e0a7e9397357c8 /activerecord/lib/active_record | |
parent | c178a26ec784f34e82f08e26064d9798edb09e72 (diff) | |
parent | 873c5a9e5924a7776692b9a17b03d0becec6e513 (diff) | |
download | rails-2b2ee222f3012a29c9db95d357a30029100b226b.tar.gz rails-2b2ee222f3012a29c9db95d357a30029100b226b.tar.bz2 rails-2b2ee222f3012a29c9db95d357a30029100b226b.zip |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/base.rb | 13 | ||||
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 15 |
3 files changed, 24 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 1b9b725dd4..f540aa7f25 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -303,7 +303,7 @@ module ActiveRecord # You can manipulate objects and associations before they are saved to the database, but there is some special behavior you should be # aware of, mostly involving the saving of associated objects. # - # Unless you set the :autosave option on a <tt>has_one</tt>, <tt>belongs_to</tt>, + # You can set the :autosave option on a <tt>has_one</tt>, <tt>belongs_to</tt>, # <tt>has_many</tt>, or <tt>has_and_belongs_to_many</tt> association. Setting it # to +true+ will _always_ save the members, whereas setting it to +false+ will # _never_ save the members. diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 5898ec3732..99043af1a5 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -220,6 +220,19 @@ module ActiveRecord #:nodoc: # user = User.create(:preferences => %w( one two three )) # User.find(user.id).preferences # raises SerializationTypeMismatch # + # == Time Zone aware attributes + # + # By default, ActiveRecord::Base keeps all the datetime columns time zone aware by executing following code. + # + # ActiveRecord::Base.time_zone_aware_attributes = true + # + # This feature can easily be turned off by assigning value <tt>false</tt> . + # + # If your attributes are time zone aware and you desire to skip time zone conversion for certain attributes then you can do following: + # + # Topic.skip_time_zone_conversion_for_attributes = [:written_on] + # + # # == Single table inheritance # # Active Record allows inheritance by storing the name of the class in a column that by default is named "type" (can be changed diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index b587abd5d0..38b91652ee 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -105,11 +105,16 @@ module ActiveRecord # Updates a single attribute and saves the record. # This is especially useful for boolean flags on existing records. Also note that # - # * validation is skipped - # * No callbacks are invoked - # * updated_at/updated_on column is updated if that column is available - # * does not work on associations - # * does not work on attr_accessor attributes. The attribute that is being updated must be column name. + # * The attribute being updated must be a column name. + # * Validation is skipped. + # * No callbacks are invoked. + # * updated_at/updated_on column is updated if that column is available. + # * Does not work on associations. + # * Does not work on attr_accessor attributes. + # * Does not work on new record. <tt>record.new_record?</tt> should return false for this method to work. + # * Updates only the attribute that is input to the method. If there are other changed attributes then + # those attributes are left alone. In that case even after this method has done its work <tt>record.changed?</tt> + # will return true. # def update_attribute(name, value) raise ActiveRecordError, "#{name.to_s} is marked as readonly" if self.class.readonly_attributes.include? name.to_s |