From 70339d2453fe4c297da982a6693c4c2889e2c294 Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Tue, 5 Oct 2021 19:34:35 +0000 Subject: 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 --- app/controllers/watchers_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3