lib/scrivito/migrations/cms_backend.rb in scrivito_sdk-1.9.1 vs lib/scrivito/migrations/cms_backend.rb in scrivito_sdk-1.10.0.rc1
- old
+ new
@@ -8,21 +8,28 @@
''
end
end
def save(value)
- CmsRestApi.put(endpoint("objs/#{migration_store_obj.id}"),
- obj: {versions: ['string', value]})
+ Workspace.current.update_obj(migration_store_obj.id,
+ { obj: { versions: ['string', value] } })
Workspace.current.reload
end
private
def create
- CmsRestApi.post(endpoint('objs'),
- obj: {_path: path, _obj_class: 'MigrationStore', versions: ['string', '']})
+ obj_id = SecureRandom.hex(8)
+ Workspace.current.update_obj(obj_id, {
+ obj: {
+ _id: obj_id,
+ _obj_class: 'MigrationStore',
+ _path: path,
+ versions: ['string', ''],
+ }
+ })
Workspace.current.reload
end
def migration_store_obj
@@ -34,13 +41,9 @@
Obj.find_by_path(path)
end
def path
'/_internal/migration-store'
- end
-
- def endpoint(path)
- "workspaces/#{Workspace.current.id}/#{path}"
end
end
end
end