aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/mysql
diff options
context:
space:
mode:
authorEileen Uchitelle <eileencodes@gmail.com>2018-12-05 15:36:29 -0500
committerEileen Uchitelle <eileencodes@gmail.com>2018-12-07 08:53:47 -0500
commitdb54afba2e86ec9e45a8feb6e3ed325c99e7c5ed (patch)
treea41277a318319b5ca5cd2e9b33315ba5699dbfea /activerecord/lib/active_record/connection_adapters/mysql
parentd9816546494f66e76bd5012a91b872dc2096a06c (diff)
downloadrails-db54afba2e86ec9e45a8feb6e3ed325c99e7c5ed.tar.gz
rails-db54afba2e86ec9e45a8feb6e3ed325c99e7c5ed.tar.bz2
rails-db54afba2e86ec9e45a8feb6e3ed325c99e7c5ed.zip
Rename error that occurs when writing on a read
I originally named this `StatementInvalid` because that's what we do in GitHub, but `@tenderlove` pointed out that this means apps can't test for or explitly rescue this error. `StatementInvalid` is pretty broad so I've renamed this to `ReadOnlyError`.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/mysql')
-rw-r--r--activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb
index 43e2f628dc..56f777f3be 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb
@@ -29,7 +29,7 @@ module ActiveRecord
# Executes the SQL statement in the context of this connection.
def execute(sql, name = nil)
if preventing_writes? && write_query?(sql)
- raise ActiveRecord::StatementInvalid, "Write query attempted while in readonly mode: #{sql}"
+ raise ActiveRecord::ReadOnlyError, "Write query attempted while in readonly mode: #{sql}"
end
# make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been