Permalink
Browse files

readonly info for save and save!

  • Loading branch information...
1 parent 1badf20 commit 5e71e92235b8a02b8594927e6ce3a3d50a28afa5 Neeraj Singh committed Apr 17, 2013
Showing with 6 additions and 0 deletions.
  1. +6 −0 activerecord/lib/active_record/persistence.rb
@@ -99,6 +99,9 @@ def persisted?
# <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 @@ def save(*)
# 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

0 comments on commit 5e71e92

Please sign in to comment.