diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2013-05-01 16:24:13 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2013-05-01 16:24:13 +0530 |
commit | 7ead1d81431b2c2c0366347b7bfdf9a329b6f934 (patch) | |
tree | 9a6a18fbb185cf2dfa48016dd32c787fe352752e /activerecord | |
parent | 78db16d440c610edeb8b2bb37233a5991caf4a29 (diff) | |
parent | 8476932aacbc45ce38b007cca0bb3f12e741f709 (diff) | |
download | rails-7ead1d81431b2c2c0366347b7bfdf9a329b6f934.tar.gz rails-7ead1d81431b2c2c0366347b7bfdf9a329b6f934.tar.bz2 rails-7ead1d81431b2c2c0366347b7bfdf9a329b6f934.zip |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/autosave_association.rb | 3 | ||||
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 8 | ||||
-rw-r--r-- | activerecord/lib/active_record/validations/associated.rb | 4 |
3 files changed, 12 insertions, 3 deletions
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 <tt>autosave: false</tt> is not same as not declaring <tt>:autosave</tt>. - # When the <tt>:autosave</tt> option is not present new associations are saved. + # When the <tt>:autosave</tt> option is not present then new association records are + # saved but the updated association records are not saved. # # == Validation # diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index 178db07ca1..a8905ed739 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -99,6 +99,9 @@ module ActiveRecord # <tt>before_*</tt> 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 <tt>before_*</tt> callbacks return +false+ the action is cancelled # and <tt>save!</tt> 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 @@ -204,6 +210,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) 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 |