-
Notifications
You must be signed in to change notification settings - Fork 13
Release 9.1: Filestack security update
Dave Kaplan edited this page Mar 1, 2019
·
1 revision
Now that we are using the security settings in Filestack, the frontend really needs the filestack handle
and not the URL. Given the API key and security token (provided by the backend), the frontend figures out the correct/secure timestamped URL using the Filestack API.
This migration updates cached collection covers to store the handle
of the image cover.
Collection.find_in_batches do |batch|
batch.each do |c|
cover = c.cached_cover
next unless cover.present? && cover['item_id_media'].present? #&& cover['image_handle'].blank?
i = Item.find_by(id: cover['item_id_media'])
next unless i
cover['image_handle'] = i.filestack_file_handle if i.filestack_file_handle
c.cached_cover = cover
c.update_column :cached_attributes, c.cached_attributes
end
end