contentful-management.rb icon indicating copy to clipboard operation
contentful-management.rb copied to clipboard

Entry destroy not working as expected

Open crowdcow-shae opened this issue 4 years ago • 1 comments

Unpublish & archive working but destroy results in this error FrozenError (can't modify frozen String: ""). Tried unpublishing and/or archiving first, but destroy still failed. Is there some other config or process to destroy entries?

module ContentfulAdapter
  module Management
    module DeleteEntries
      module_function

      def delete_all(entry_type:)
        cms_client = ContentfulAdapter::Management::CreateClient.call
        space = cms_client.spaces.find(ENV['CONTENTFUL_SPACE'])
        entries = space.entries.all(content_type: entry_type)

        entries.each do |entry|
          entry.unpublish
          entry.destroy
        end
      end
    end
  end
end

crowdcow-shae avatar Jan 20 '21 23:01 crowdcow-shae

Hey @crowdcow-shae, thanks for reporting the issue. 



I am looking into it. I will get back to you if I need more details.

Cheers

rubydog avatar Jan 21 '21 03:01 rubydog