Remove model validation
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user