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(+) 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