diff --git a/app/models/concerns/pageflow/reusable_file.rb b/app/models/concerns/pageflow/reusable_file.rb index f4bd2a72c8..eebafce533 100644 --- a/app/models/concerns/pageflow/reusable_file.rb +++ b/app/models/concerns/pageflow/reusable_file.rb @@ -30,8 +30,8 @@ def parent_allows_type_for_nesting file_type_of_parent = Pageflow.config.file_types.find_by_model!(parent_class) models_of_nested_file_types = file_type_of_parent.nested_file_types.map(&:model) unless models_of_nested_file_types.include?(self.class) - errors[:base] << 'File type of provided parent file does not permit nesting files of '\ - "type #{self.class.name}" + errors.add(:base, 'File type of provided parent file does not permit nesting files of '\ + "type #{self.class.name}") end end end @@ -39,7 +39,7 @@ def parent_allows_type_for_nesting def parent_belongs_to_same_entry if parent_file.present? unless parent_file.using_entries.include?(entry) - errors[:base] << 'Parent file does not belong to same entry as nested file' + errors.add(:base, 'Parent file does not belong to same entry as nested file') end end end diff --git a/app/models/pageflow/membership.rb b/app/models/pageflow/membership.rb index bcc5bf3a70..0850ddf16e 100644 --- a/app/models/pageflow/membership.rb +++ b/app/models/pageflow/membership.rb @@ -38,8 +38,9 @@ class Membership < ApplicationRecord private def account_membership_exists - errors[:base] << 'Entry Membership misses presupposed Membership on account of entry' if - user.present? && !user.accounts.include?(entity.account) + return if user.blank? || user.accounts.include?(entity.account) + + errors.add(:base, 'Entry Membership misses presupposed Membership on account of entry') end def on_entry?