From 58205e7f9d6437410aa26698552a0ff6a25e2228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Ezr?= Date: Thu, 10 Jun 2021 15:14:24 +0200 Subject: [PATCH] Fixes #32772 - allow present? on ApplicationRecord This is partial cherry-pick of 641c3f4a9bb5401a8ac06e70b925918125193957. We do not allow `present?` on ApplicationRecord in safemode. This caused Environment#present? failures in puppet.conf on Foreman 2.5 because it got introduced in 2.6 by 641c3f4a9bb5401a8ac06e70b925918125193957 --- app/models/application_record.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 7568ef9b057..aff394db936 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -8,6 +8,11 @@ class ApplicationRecord < ActiveRecord::Base meta_example = ", e.g. #{@meta[:example]}" if @meta[:example] name_desc = @meta[:name_desc] || "Name of the #{@meta[:friendly_name] || @meta[:class_scope]}#{meta_example}" property :name, String, desc: name_desc + property :present?, one_of: [true, false], desc: 'Object presence (always true)' + end + + class Jail < Safemode::Jail + allow :id, :name, :present? end self.abstract_class = true