mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
readonly info for save and save!
This commit is contained in:
parent
1badf20497
commit
5e71e92235
1 changed files with 6 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue