From: Marius Balteanu Date: Tue, 5 Oct 2021 19:34:35 +0000 (+0000) Subject: Merged r21235 from trunk to 4.1-stable (#35463). X-Git-Tag: 4.1.5~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=70339d2453fe4c297da982a6693c4c2889e2c294;p=redmine.git Merged r21235 from trunk to 4.1-stable (#35463). git-svn-id: http://svn.redmine.org/redmine/branches/4.1-stable@21237 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index f0692e31d..023f7e403 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -134,7 +134,9 @@ class WatchersController < ApplicationController def find_objets_from_params klass = Object.const_get(params[:object_type].camelcase) rescue nil - return unless klass && klass.respond_to?('watched_by') + return unless klass && Class === klass # rubocop:disable Style/CaseEquality + return unless klass < ActiveRecord::Base + return unless klass < Redmine::Acts::Watchable::InstanceMethods scope = klass.where(:id => Array.wrap(params[:object_id])) if klass.reflect_on_association(:project)