Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Active Record errors deprecation warning #2015

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/models/concerns/pageflow/reusable_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ 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

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
Expand Down
5 changes: 3 additions & 2 deletions app/models/pageflow/membership.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
Loading