aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql
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/postgresql
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/postgresql')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
index 2d5b592639..d93c1f449e 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
@@ -80,7 +80,7 @@ module ActiveRecord
# need it specifically, you may want consider the <tt>exec_query</tt> wrapper.
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
materialize_transactions