aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJohannes Barre <igel@igels.net>2012-05-10 13:47:50 +0200
committerJohannes Barre <igel@igels.net>2012-05-17 17:52:17 +0200
commita8b370f5c2fed87001e363d18ce60a47c1748885 (patch)
tree0b7d8182025899135edffdae6de8b734b96c0d7a /activerecord/lib
parent85ac14309c7b6faf846072fc012e14a0f31694e9 (diff)
downloadrails-a8b370f5c2fed87001e363d18ce60a47c1748885.tar.gz
rails-a8b370f5c2fed87001e363d18ce60a47c1748885.tar.bz2
rails-a8b370f5c2fed87001e363d18ce60a47c1748885.zip
Don't destroy readonly models
Diffstat (limited to 'activerecord/lib')
-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