Remove model validation

This commit is contained in:
Stanko K.R.
2026-02-02 13:38:34 +01:00
parent 54a7ecea98
commit d7dcf64310
3 changed files with 2 additions and 12 deletions
@@ -93,16 +93,6 @@ class Account::DataTransfer::RecordSet
if model.exists?(id: data["id"])
raise IntegrityError, "#{model} record with ID #{data['id']} already exists"
end
record = model.new(data.slice(*attributes).merge("account_id" => account.id))
belongs_to_associations = model.reflect_on_all_associations(:belongs_to).map { |a| a.name.to_s }
record.validate
errors = record.errors.reject { |e| belongs_to_associations.include?(e.attribute.to_s) }
if errors.any?
raise IntegrityError, "Validation failed for #{model} record ID #{data['id']}: #{errors.map(&:full_message).join(', ')}"
end
end
def skip_to(file_list, last_id)
+1 -1
View File
@@ -7,7 +7,7 @@ class Assignment < ApplicationRecord
belongs_to :assignee, class_name: "User"
belongs_to :assigner, class_name: "User"
validate :within_limit, on: :create, if: -> { card.present? }
validate :within_limit, on: :create
private
def within_limit
+1 -1
View File
@@ -25,7 +25,7 @@ class Comment < ApplicationRecord
private
def card_is_commentable
errors.add(:card, "does not allow comments") unless card&.commentable?
errors.add(:card, "does not allow comments") unless card.commentable?
end
def watch_card_by_creator