aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-10-05 02:16:58 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-10-05 02:16:58 +0900
commit5c7c3fe0d7059ba62e14bf6ac4ddfbdcabd905a6 (patch)
treede72af7ae034ab9af0d476e172facb5c1151adae /activerecord
parentcba27402388380d672199a1a46de0a06ef383332 (diff)
downloadrails-5c7c3fe0d7059ba62e14bf6ac4ddfbdcabd905a6.tar.gz
rails-5c7c3fe0d7059ba62e14bf6ac4ddfbdcabd905a6.tar.bz2
rails-5c7c3fe0d7059ba62e14bf6ac4ddfbdcabd905a6.zip
Simplify the condition in `prepare_update_statement`
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/arel/visitors/mysql.rb10
1 files changed, 2 insertions, 8 deletions
diff --git a/activerecord/lib/arel/visitors/mysql.rb b/activerecord/lib/arel/visitors/mysql.rb
index 081452caeb..9d9294fecc 100644
--- a/activerecord/lib/arel/visitors/mysql.rb
+++ b/activerecord/lib/arel/visitors/mysql.rb
@@ -69,13 +69,7 @@ module Arel # :nodoc: all
# query. However, this does not allow for LIMIT, OFFSET and ORDER. To support
# these, we must use a subquery.
def prepare_update_statement(o)
- if has_join_sources?(o)
- if has_limit_or_offset_or_orders?(o)
- super
- else
- o
- end
- elsif o.offset
+ if o.offset || has_join_sources?(o) && has_limit_or_offset_or_orders?(o)
super
else
o
@@ -83,7 +77,7 @@ module Arel # :nodoc: all
end
def prepare_delete_statement(o)
- if has_join_sources?(o) || o.offset
+ if o.offset || has_join_sources?(o)
super
else
o