aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/persistence.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-05-17 09:56:21 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-05-17 09:56:21 -0700
commit6ada771a08196d8a5d790f8b4b2224aa8e1748b3 (patch)
tree711fd81e0a6b1f06560b46edde8852519d534999 /activerecord/lib/active_record/persistence.rb
parenta8f568e1ec4ce7c2346e98174466a616dc0cc3f3 (diff)
parenta8b370f5c2fed87001e363d18ce60a47c1748885 (diff)
downloadrails-6ada771a08196d8a5d790f8b4b2224aa8e1748b3.tar.gz
rails-6ada771a08196d8a5d790f8b4b2224aa8e1748b3.tar.bz2
rails-6ada771a08196d8a5d790f8b4b2224aa8e1748b3.zip
Merge pull request #6250 from iGEL/dont_destroy_readonly_models
Don't allow to destroy readonly models
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r--activerecord/lib/active_record/persistence.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index 4a987c2343..a1bc39a32d 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -123,6 +123,7 @@ module ActiveRecord
# Deletes the record in the database and freezes this instance to reflect
# that no changes should be made (since they can't be persisted).
def destroy
+ raise ReadOnlyRecord if readonly?
destroy_associations
destroy_row if persisted?
@destroyed = true