summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-21 15:39:56 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-21 15:39:56 +0200
commitcc4659a308590be083065f19df8571efc345052a (patch)
treed53a3b89670333d2b12662fcdc41b4d130c4d5d9 /app/models
parentbd7863dbeffc2d5b41a58f8138e5691b60fc63f3 (diff)
Remove Page#update_assets
Only caller left was the sort_images action removed last commit. Kept alive only as a test-setup convenience for diff_against coverage, which is what it actually was -- an implicit API with no deliberate contract, sitting there for anyone to call. Rewrote the one test to set up its fixture state directly via related_assets rather than through a method whose real job was already done.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/page.rb16
1 files changed, 0 insertions, 16 deletions
diff --git a/app/models/page.rb b/app/models/page.rb
index ab42b1c..c1498fc 100644
--- a/app/models/page.rb
+++ b/app/models/page.rb
@@ -319,22 +319,6 @@ class Page < ApplicationRecord
319 end 319 end
320 end 320 end
321 321
322 def update_assets image_ids
323 transaction do
324 previous_headline_asset_id = self.related_assets.find_by(headline: true)&.asset_id
325
326 self.related_assets.delete_all
327
328 if image_ids
329 image_ids.each_with_index do |id, index|
330 asset = Asset.find(id)
331 self.related_assets.create!(:asset_id => asset.id, :position => index+1,
332 :headline => asset.id == previous_headline_asset_id)
333 end
334 end
335 end
336 end
337
338 # Installs (or re-installs) the trigger that keeps page_translations' 322 # Installs (or re-installs) the trigger that keeps page_translations'
339 # search_vector in sync. Idempotent, safe to call on every boot. 323 # search_vector in sync. Idempotent, safe to call on every boot.
340 # search_vector is populated by a raw Postgres trigger, not anything 324 # search_vector is populated by a raw Postgres trigger, not anything