aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/persistence.rb
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2013-04-17 06:33:33 -0400
committerNeeraj Singh <neerajdotname@gmail.com>2013-04-17 17:27:59 -0400
commit5e71e92235b8a02b8594927e6ce3a3d50a28afa5 (patch)
tree07e9dbcf2895a5141de4bed3cd9322cfd04a1d97 /activerecord/lib/active_record/persistence.rb
parent1badf20497828cf20f86455fb958832cc5104c08 (diff)
downloadrails-5e71e92235b8a02b8594927e6ce3a3d50a28afa5.tar.gz
rails-5e71e92235b8a02b8594927e6ce3a3d50a28afa5.tar.bz2
rails-5e71e92235b8a02b8594927e6ce3a3d50a28afa5.zip
readonly info for save and save!
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r--activerecord/lib/active_record/persistence.rb6
1 files changed, 6 insertions, 0 deletions
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
# <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