このコミットが含まれているのは:
2026-07-17 23:14:37 +09:00
コミット 0ae41b6266
19個のファイルの変更455行の追加216行の削除
+14 -18
ファイルの表示
@@ -55,14 +55,21 @@ class PostBulkCreator
errors: e.record.errors.to_hash,
base_errors: e.record.errors[:base] }
rescue ActiveRecord::RecordNotUnique => e
raise unless e.message.include?('index_posts_on_url')
existing_post = existing_post_for_race(attributes)
raise if existing_post.nil?
if e.message.include?('index_posts_on_url')
existing_post = existing_post_for_race(attributes)
return {
status: 'skipped',
existing_post: existing_post } if existing_post.present?
end
Rails.logger.error(
"post_bulk_creator_record_not_unique #{ { error: e.class.name,
message: e.message }.to_json }")
{
status: 'skipped',
existing_post: existing_post }
status: 'failed',
recoverable: false,
errors: { base: ['登録中にエラーが発生しました.'] },
base_errors: [] }
rescue Tag::NicoTagNormalisationError
{
status: 'failed',
@@ -134,17 +141,6 @@ class PostBulkCreator
end
def compact_existing_post post
return nil if post.nil?
{
id: post.id,
title: post.title,
url: post.url,
thumbnail_url:
if post.thumbnail.attached?
Rails.application.routes.url_helpers.rails_storage_proxy_url(
post.thumbnail,
only_path: false)
end }
PostCompactRepr.base(post)
end
end