diff options
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/page.rb | 16 |
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 |
