DEV: Fix dev plugin reloading issue (#215)

DEV: Fix dev plugin reloading issue (#215)

diff --git a/plugin.rb b/plugin.rb
index 2d8f010..2d87958 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -46,21 +46,23 @@ after_initialize do
     end
   end
 
-  class ::Topic
-    has_one :assignment, dependent: :destroy
-  end
-
-  class ::Group
-    scope :assignable, ->(user) {
-      where("assignable_level in (:levels) OR
-          (
-            assignable_level = #{ALIAS_LEVELS[:members_mods_and_admins]} AND id in (
-            SELECT group_id FROM group_users WHERE user_id = :user_id)
-          ) OR (
-            assignable_level = #{ALIAS_LEVELS[:owners_mods_and_admins]} AND id in (
-            SELECT group_id FROM group_users WHERE user_id = :user_id AND owner IS TRUE)
-          )", levels: alias_levels(user), user_id: user && user.id)
-    }
+  reloadable_patch do |plugin|
+    class ::Topic
+      has_one :assignment, dependent: :destroy
+    end
+
+    class ::Group
+      scope :assignable, ->(user) {
+        where("assignable_level in (:levels) OR
+            (
+              assignable_level = #{ALIAS_LEVELS[:members_mods_and_admins]} AND id in (
+              SELECT group_id FROM group_users WHERE user_id = :user_id)
+            ) OR (
+              assignable_level = #{ALIAS_LEVELS[:owners_mods_and_admins]} AND id in (
+              SELECT group_id FROM group_users WHERE user_id = :user_id AND owner IS TRUE)
+            )", levels: alias_levels(user), user_id: user && user.id)
+      }
+    end
   end
 
   frequency_field = PendingAssignsReminder::REMINDERS_FREQUENCY

GitHub sha: dd37f66f5dc60f271b43aa8d0e6bafa7b5924152

This commit appears in #215 which was approved by davidtaylorhq. It was merged by pmusaraj.