You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
client=Contentful::Management::Client.new(ENV['CONTENTFUL_ACCESS_TOKEN'])space=client.spaces.find(ENV['CONTENTFUL_SPACE_ID'])environment=client.environments(space.id).find('master')upload=client.uploads(space.id).create(image.image.path)# create the associated filefile=Contentful::Management::File.newfile.properties[:contentType]=image.mime_typefile.properties[:fileName]=image.image_namefile.properties[:uploadFrom]=upload.to_link_json# create the asset with the associated file/uploadasset=client.assets(space.id,environment.id).create(title_with_locales: {'en-NZ'=>image.title},file_with_locales: {'en-NZ'=>file})asset.process_file
which is pretty much the example from the README.md
However this doesn't work. The created asset is "Untitled" with no attachment (looking at the Contentful UI).
Hi,
I have this code snippet:
which is pretty much the example from the README.md
However this doesn't work. The created asset is "Untitled" with no attachment (looking at the Contentful UI).
I tried this fix:
which is renaming the asset and linking the upload. Do you know why I need to set the attributes twice?
The text was updated successfully, but these errors were encountered: