From c9fe3c3bd0ee5010a36a157fe850ef6e8ffb147d Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Tue, 27 Jul 2010 13:55:00 -0400 Subject: adding comments to update_attribute method --- activerecord/lib/active_record/persistence.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index b587abd5d0..869cbf5b2e 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -110,6 +110,10 @@ module ActiveRecord # * 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. + # * does not work on new record. record.new_record? 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 record.changed? + # 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 -- cgit v1.2.3 From 1793b21479d29ec29bd47c37ee68cb6ebdb71617 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Tue, 27 Jul 2010 14:27:15 -0700 Subject: Frameworks are loaded in application.rb rather than config.rb according to Rails 3 conventions. --- activerecord/lib/active_record/railties/databases.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index 2c17c74ab4..d61cc520b7 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -333,7 +333,7 @@ namespace :db do if File.exists?(file) load(file) else - abort %{#{file} doesn't exist yet. Run "rake db:migrate" to create it then try again. If you do not intend to use a database, you should instead alter #{Rails.root}/config/boot.rb to limit the frameworks that will be loaded} + abort %{#{file} doesn't exist yet. Run "rake db:migrate" to create it then try again. If you do not intend to use a database, you should instead alter #{Rails.root}/config/application.rb to limit the frameworks that will be loaded} end end end -- cgit v1.2.3 From 67e79cf96d6bd27779a659703253984ac47a90ee Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 27 Jul 2010 23:31:59 +0200 Subject: Revert "Frameworks are loaded in application.rb rather than config.rb according to Rails 3 conventions." This reverts commit 1793b21479d29ec29bd47c37ee68cb6ebdb71617. This commit had no risk, but docrails has a hard rule about touching code. The contribution is appreciated, I hope you do not mind this technical revert. I'll apply that to master with proper credit. --- activerecord/lib/active_record/railties/databases.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index d61cc520b7..2c17c74ab4 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -333,7 +333,7 @@ namespace :db do if File.exists?(file) load(file) else - abort %{#{file} doesn't exist yet. Run "rake db:migrate" to create it then try again. If you do not intend to use a database, you should instead alter #{Rails.root}/config/application.rb to limit the frameworks that will be loaded} + abort %{#{file} doesn't exist yet. Run "rake db:migrate" to create it then try again. If you do not intend to use a database, you should instead alter #{Rails.root}/config/boot.rb to limit the frameworks that will be loaded} end end end -- cgit v1.2.3 From 51924d49af18635cab46720e208c34d75ed8363e Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Wed, 28 Jul 2010 12:51:09 -0400 Subject: more documentation for update_attribute --- activerecord/lib/active_record/persistence.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index 869cbf5b2e..36530d2b63 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -105,13 +105,14 @@ 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 + # * 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. The attribute that is being updated must be column name. - # * does not work on new record. record.new_record? 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 + # * Does not work on associations + # * Does not work on attr_accessor attributes. + # * Does not work on new record. record.new_record? 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 record.changed? # will return true. # -- cgit v1.2.3 From 31f8a0cd23ca3d1137968e95bce47a431555bdd6 Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Wed, 28 Jul 2010 13:10:04 -0400 Subject: adding punctuations --- activerecord/lib/active_record/persistence.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index 36530d2b63..38b91652ee 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -106,10 +106,10 @@ module ActiveRecord # This is especially useful for boolean flags on existing records. Also note that # # * 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 + # * 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. record.new_record? 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 -- cgit v1.2.3 From f46e841f7217dd839ce166ec9a592f0dec127673 Mon Sep 17 00:00:00 2001 From: Simon Tokumine Date: Wed, 28 Jul 2010 14:56:05 -0700 Subject: removed ambiguity from autosave description --- activerecord/lib/active_record/associations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') 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 has_one, belongs_to, + # You can set the :autosave option on a has_one, belongs_to, # has_many, or has_and_belongs_to_many association. Setting it # to +true+ will _always_ save the members, whereas setting it to +false+ will # _never_ save the members. -- cgit v1.2.3 From 873c5a9e5924a7776692b9a17b03d0becec6e513 Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Thu, 29 Jul 2010 10:29:33 -0400 Subject: adding documentation regarding time_zone_aware_attributes and skip_time_zone_conversion_for_attributes --- activerecord/lib/active_record/base.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'activerecord/lib') 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 false . + # + # 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 -- cgit v1.2.3