From d7dcf64310711a5c2b9c028c28c76e8ead0c5263 Mon Sep 17 00:00:00 2001 From: "Stanko K.R." Date: Mon, 2 Feb 2026 13:38:34 +0100 Subject: [PATCH] Remove model validation --- app/models/account/data_transfer/record_set.rb | 10 ---------- app/models/assignment.rb | 2 +- app/models/comment.rb | 2 +- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/app/models/account/data_transfer/record_set.rb b/app/models/account/data_transfer/record_set.rb index 1a824db17..ed3039210 100644 --- a/app/models/account/data_transfer/record_set.rb +++ b/app/models/account/data_transfer/record_set.rb @@ -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) diff --git a/app/models/assignment.rb b/app/models/assignment.rb index 28728124f..75ffde959 100644 --- a/app/models/assignment.rb +++ b/app/models/assignment.rb @@ -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 diff --git a/app/models/comment.rb b/app/models/comment.rb index ec916ccc3..70a36562f 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -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