From 5c7c3fe0d7059ba62e14bf6ac4ddfbdcabd905a6 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Fri, 5 Oct 2018 02:16:58 +0900 Subject: Simplify the condition in `prepare_update_statement` --- activerecord/lib/arel/visitors/mysql.rb | 10 ++-------- 1 file 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 -- cgit v1.2.3