Skip to content

Commit fd97e9f

Browse files
committed
Provide backward compatible way to globally set permitted classes
This supports rails 7 and 6.1. Similar to the change in: ManageIQ/manageiq#22887
1 parent a772b9d commit fd97e9f

File tree

1 file changed

+5
-1
lines changed
  • app/controllers/ops_controller/settings

1 file changed

+5
-1
lines changed

app/controllers/ops_controller/settings/common.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ def pglogical_save_subscriptions
182182
task_opts = {:action => "Save subscriptions for global region", :userid => session[:userid]}
183183
queue_opts = {:class_name => "MiqPglogical", :method_name => "save_global_region",
184184
:args => [subscriptions_to_save, subsciptions_to_remove]}
185-
ActiveRecord::Base.yaml_column_permitted_classes |= [subscriptions_to_save.first.class, subsciptions_to_remove.first.class]
185+
if ActiveRecord.respond_to?(:yaml_column_permitted_classes)
186+
ActiveRecord.yaml_column_permitted_classes = YamlPermittedClasses.app_yaml_permitted_classes | [subscriptions_to_save.first.class, subsciptions_to_remove.first.class]
187+
else
188+
ActiveRecord::Base.yaml_column_permitted_classes = YamlPermittedClasses.app_yaml_permitted_classes | [subscriptions_to_save.first.class, subsciptions_to_remove.first.class]
189+
end
186190
when "remote"
187191
task_opts = {:action => "Configure the database to be a replication remote region",
188192
:userid => session[:userid]}

0 commit comments

Comments
 (0)