activestorage-nft 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 621576ef5625a89648ef4e24111bff5a466d2f5cb40e4aafc0d0bc2fca0560de
4
- data.tar.gz: 79f77aac7c49fb69100852ae64347ca252ad9351e871a11b4e0cc774344dd6d8
3
+ metadata.gz: 1972440956f424c80c336dac03420a00992c94bdc6daea4a26320d9d01114281
4
+ data.tar.gz: d5729065c466a6e72b50f9fe837e380ab222f0770399052d8568a6e8f9ade714
5
5
  SHA512:
6
- metadata.gz: 6d4f0fcebf20d477fa1acf7266a4d80401f6f9b146a4093d9d41bfc1649bec48ab9565ca2d8ab50539aa18739bf850587e029c74c967030ff10f575abdc8df44
7
- data.tar.gz: a9281cbb5cbb39d50f74fe90ea385920fedd196863b785fbc27a058f54887eb89feca0a061df563ab6f6631ff94a25eb0cb647b482aefbee8bcb6f2f36660e80
6
+ metadata.gz: f91c7c080cd4c401efd5bf2ad3215b121eabad23d5f67e33fb08d5122f2029259d7a5625f133e62c92ec571d88165ee6d472d5e34f11e8535a8bd1aab5cab990
7
+ data.tar.gz: 4346b3d021f1c34f730b71ea870becdf1120df6a3b990dd6994ff54cbb2f5056ce5e31c32b917a5e1abf42905762c985716b44015bdd40e9cd7985c874a8a18d
data/README.md CHANGED
@@ -4,7 +4,9 @@ ActiveStorage adapter for [NFT.storage](https://nft.storage).
4
4
 
5
5
  Uploaded files are automatically pinned on the pinata.cloud IPFS pinning service, courtesey of [Protocol Labs](https://protocol.ai).
6
6
 
7
- Please note: This adapter adds a `unique` validation on ActiveRecord::Blob and will raise a validation error when trying to upload a file that already exists.
7
+ ## Note on uniqueness
8
+
9
+ When uploading a file that already exists (same content hash), an `ActiveRecord::RecordNotUnique` exception will be raised.
8
10
 
9
11
  ## Installation
10
12
 
@@ -1,9 +1,5 @@
1
1
  require 'nft/client'
2
2
 
3
- class ActiveStorage::Blob
4
- validates :key, uniqueness: true
5
- end
6
-
7
3
  module ActiveStorage
8
4
  class Service::NftService < Service
9
5
  attr_accessor :client
@@ -18,9 +14,7 @@ module ActiveStorage
18
14
  def upload(key, io, checksum: nil, **)
19
15
  instrument :upload, key: key, checksum: checksum do
20
16
  cid_key = @client.add io.path
21
- blob = Blob.find_by_key(key)
22
- blob.key = cid_key
23
- blob.save!
17
+ blob = Blob.find_by_key(key).update!(key: cid_key)
24
18
  end
25
19
  end
26
20
 
@@ -1,5 +1,5 @@
1
1
  module ActiveStorage
2
2
  module NftService
3
- VERSION = '0.0.4'.freeze
3
+ VERSION = '0.0.5'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activestorage-nft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Buhrmester