From ee48cf69eeb04a21941922c7f840babe3b619c6e Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Wed, 17 Apr 2013 05:06:55 -0400 Subject: without autosave option updated records not save Emphasizing that without autosave option only new records are saved and updated records are not saved --- activerecord/lib/active_record/autosave_association.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb index 44323ce9db..b0bd78ad46 100644 --- a/activerecord/lib/active_record/autosave_association.rb +++ b/activerecord/lib/active_record/autosave_association.rb @@ -17,7 +17,8 @@ module ActiveRecord # be destroyed directly. They will however still be marked for destruction. # # Note that autosave: false is not same as not declaring :autosave. - # When the :autosave option is not present new associations are saved. + # When the :autosave option is not present then new association records are + # saved but the updated association records are not saved. # # == Validation # -- cgit v1.2.3 From 5ea8ff095133eb8a9d8fe90f26f3d14b76b3ecdf Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Wed, 17 Apr 2013 05:54:07 -0400 Subject: updated rdoc to reflect info about readonly attribute --- activerecord/lib/active_record/persistence.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index 42cece3ad0..cffe7e2050 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -204,6 +204,8 @@ module ActiveRecord # * updated_at/updated_on column is updated if that column is available. # * Updates all the attributes that are dirty in this object. # + # This method raises an +ActiveRecord::ActiveRecordError+ if the + # attribute is marked as readonly. def update_attribute(name, value) name = name.to_s verify_readonly_attribute(name) -- cgit v1.2.3 From 14254d82a90b8aa4bd81f7eeebe33885bf83c378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hrvoje=20=C5=A0imi=C4=87?= Date: Wed, 17 Apr 2013 16:02:13 +0200 Subject: documentation fixes for Array.wrap and AR::Validations::AssociatedValidator --- activerecord/lib/active_record/validations/associated.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/validations/associated.rb b/activerecord/lib/active_record/validations/associated.rb index 7f1972ccf9..744780d069 100644 --- a/activerecord/lib/active_record/validations/associated.rb +++ b/activerecord/lib/active_record/validations/associated.rb @@ -9,8 +9,8 @@ module ActiveRecord end module ClassMethods - # Validates whether the associated object or objects are all valid - # themselves. Works with any kind of association. + # Validates whether the associated object or objects are all valid. + # Works with any kind of association. # # class Book < ActiveRecord::Base # has_many :pages -- cgit v1.2.3 From 5e71e92235b8a02b8594927e6ce3a3d50a28afa5 Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Wed, 17 Apr 2013 06:33:33 -0400 Subject: readonly info for save and save! --- activerecord/lib/active_record/persistence.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index cffe7e2050..fbb64ad68d 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -99,6 +99,9 @@ module ActiveRecord # before_* callbacks return +false+ the action is cancelled and # +save+ returns +false+. See ActiveRecord::Callbacks for further # details. + # + # Attributes marked as readonly are silently ignored if the record is + # being updated. def save(*) create_or_update rescue ActiveRecord::RecordInvalid @@ -118,6 +121,9 @@ module ActiveRecord # the before_* callbacks return +false+ the action is cancelled # and save! raises ActiveRecord::RecordNotSaved. See # ActiveRecord::Callbacks for further details. + # + # Attributes marked as readonly are silently ignored if the record is + # being updated. def save!(*) create_or_update || raise(RecordNotSaved) end -- cgit v1.2.3