FIX: Skip callbacks when migrating.
This commit is contained in:
parent
98fd77fb6c
commit
303282670f
|
@ -6,12 +6,12 @@ class AddUploadsToCategories < ActiveRecord::Migration
|
|||
transaction do
|
||||
Category.find_each do |category|
|
||||
logo_upload = Upload.find_by(url: category.logo_url)
|
||||
category.uploaded_logo_id = logo_upload.id if logo_upload
|
||||
|
||||
background_upload = Upload.find_by(url: category.background_url)
|
||||
category.uploaded_background_id = background_upload.id if background_upload
|
||||
|
||||
category.save!
|
||||
category.update_columns(
|
||||
uploaded_logo_id: logo_upload&.id,
|
||||
uploaded_background_id: background_upload&.id
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue