From db1820f39c0c019098d69d0c5a9b1d2f4056eb19 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Mon, 14 Sep 2015 15:34:28 -0400 Subject: [PATCH] make it possible for plugins to add methods to classes that don't follow naming conventions --- lib/plugin/instance.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rb index eef8d5ba2ea..d51adc4f139 100644 --- a/lib/plugin/instance.rb +++ b/lib/plugin/instance.rb @@ -78,7 +78,7 @@ class Plugin::Instance # Adds a class method to a class, respecting if plugin is enabled def add_class_method(klass, attr, &block) - klass = klass.to_s.classify.constantize + klass = klass.to_s.classify.constantize rescue klass.to_s.constantize hidden_method_name = :"#{attr}_without_enable_check" klass.send(:define_singleton_method, hidden_method_name, &block) @@ -90,7 +90,7 @@ class Plugin::Instance end def add_model_callback(klass, callback, &block) - klass = klass.to_s.classify.constantize + klass = klass.to_s.classify.constantize rescue klass.to_s.constantize plugin = self # generate a unique method name