diff --git a/config/initializers/active_record.rb b/config/initializers/active_record.rb index 77ea266edceab..fdd544f9bc277 100644 --- a/config/initializers/active_record.rb +++ b/config/initializers/active_record.rb @@ -280,7 +280,9 @@ def save_without_touching_context end def touch_context - return if @@skip_touch_context ||= false || @skip_touch_context ||= false + skip1 = defined?(@@skip_touch_context) ? @@skip_touch_context : false + skip2 = @skip_touch_context.nil? ? false : @skip_touch_context + return if skip1 || skip2 self.class.connection.after_transaction_commit do if respond_to?(:context_type) && respond_to?(:context_id) && context_type && context_id