activestorage-delayed 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aaac3aa632c36357275cd927c68693bcdad31b86bd6f00189c651683f56fc2ae
4
- data.tar.gz: 43881344f8527dc24e3a536c7892c7c0f4886926c5045c4822e6a5c3427ab6a1
3
+ metadata.gz: 153ae98174a2430ab5b0ddfb3a2bb17ffc6b0d568306ba9b2ee55886d4b16581
4
+ data.tar.gz: a75a0db4f5a200a84a627bdf74771ee63d39260b2df769a94ecc1a93a8f75546
5
5
  SHA512:
6
- metadata.gz: 3af76bd8cacda9123509b9c81919a5a86ce38e7598b32332950484ec3930d6ecaccd59a01084c38e51702acf2eeb74155a271f5ad534bc122d13b5cca3ae80ab
7
- data.tar.gz: fc6c73a0b6fa5df9bcd01e948309a0ba7ee71c693f9646698cbfcbf10862eb9691b8c78915e0e1191d97abaaa3902e39c40ecb0dea6fdfe12070bc549ce39886
6
+ metadata.gz: 76a311ff87cc7ecf0046443834e1940563d2ed69bafc50f8d5cabbd0d7643c72f1827fb8ab89a86adf60f3e20856192d3412d9cfc8704aed3e8204f8b5379a21
7
+ data.tar.gz: 87dc98a976a1c8cbcc0a64bbda6acd3d04e3bbd42d388640ad168627e1a89e1719a17ba07735292a715ed733000e8f11b08570a5415e9bd3ca24560f311e6342
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activestorage-delayed (0.1.1)
4
+ activestorage-delayed (0.1.2)
5
5
  activestorage
6
6
  rails
7
7
 
data/README.md CHANGED
@@ -1,12 +1,19 @@
1
1
  # Activestorage Delayed
2
2
 
3
- ActiveStorage for Rails 6 and 7 does not support to upload files in background which in most cases delays the submit process and then making the visitor get bored or receive a timeout error.
4
- This is a Ruby on Rails gem to upload activestorage files in background by saving them as base64 encoded in the database and be processed later.
3
+ ActiveStorage in Rails 6 and 7 does not support to upload files in background which in most cases delays the submit process and then makes the visitor get bored or receive a timeout error.
4
+ This is a Ruby on Rails gem to upload activestorage files in background by saving them as base64 encoded in the database (important for apps hosted in kubernetes) and be processed later.
5
+
6
+ ## Features
7
+ - Upload files in background
8
+ - Ability to add new files instead of replacing the old ones when using using `has_many_attached`
9
+ - Ability to upload files with the original filename or a custom one
10
+ - Ability to preprocess the files before uploading them (Rails 7+)
11
+ Note: This gem assumes that the app has already configured activestorage.
5
12
 
6
13
  ## Installation
7
14
  - Add this line to your application's Gemfile:
8
15
  ```ruby
9
- gem 'activestorage-delayed'
16
+ gem 'activestorage-delayed', '>= 0.1.1'
10
17
  ```
11
18
  - And then execute: `bundle install`
12
19
  - Generate the migration: `rails g migration add_activestorage_delayed`
@@ -13,8 +13,7 @@ module ActivestorageDelayed
13
13
  return unless delayed_upload
14
14
 
15
15
  remove_files
16
- upload_photos
17
- save_changes
16
+ save_changes if upload_photos
18
17
  end
19
18
 
20
19
  private
@@ -25,9 +24,11 @@ module ActivestorageDelayed
25
24
  tmp_files_data.each do |file_data|
26
25
  model.send(attr_name).attach(file_data.transform_keys(&:to_sym))
27
26
  end
27
+ true
28
28
  rescue => e # rubocop:disable Style/RescueStandardError
29
29
  Rails.logger.error("********* #{self.class.name} -> Failed uploading files: #{e.message}. #{e.backtrace[0..20]}")
30
30
  model.ast_delayed_on_error(attr_name, e)
31
+ false
31
32
  end
32
33
 
33
34
  def save_changes
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActivestorageDelayed
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activestorage-delayed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Owen Peredo Diaz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-25 00:00:00.000000000 Z
11
+ date: 2022-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage