effective_resources 2.2.10 → 2.2.11

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: 3f5258d38255a23862d15be45d82d15d68596bb42b2f31f88e5159c339e2fae8
4
- data.tar.gz: c6dba77a6cdb45ec02fead79b8050cee8c482325ec772a53ffde5cea9facc754
3
+ metadata.gz: cd09d6add5f00d00573d998139d60d3fb29d7ef34af02f0e6a0edc3493480d80
4
+ data.tar.gz: 24a8993ebecfdc5204f34e370bca4c4a970a65a5ebb9ac7f5d412a00403c786b
5
5
  SHA512:
6
- metadata.gz: c0f15eacdd2e1b34c85b57921dd21d01f3dfb1b22e45f17b45c2f0a066add4f0ede0856e649e843a77c016212c5133e88b780980ce48cc30c844a6e0e735149c
7
- data.tar.gz: 22088c964406e716aa5d430372813632064278e1a02e1a4fa09f6845a1a8d55b5799a14ce2d29329b624fe59d7d7b1710fcb0437242c345848de21e9bd2a46cb
6
+ metadata.gz: 6fa8aa630baa7d68b8c66e22fa9a3700179ebf593e267640216b4138789518064c1097bd0449231a2abb11153f0de93dbd2e7bf69fc9df770064fe6934ce0896
7
+ data.tar.gz: cd135c29a2f6cbea33eafe561e062e9b6659522403c781099aa23e9f17e0b860590eb0fea2f54d995ab42e63cb01abe92ac1304305bcfa7b8c7342e2d00b528b
@@ -1,11 +1,14 @@
1
1
  # HasManyPurgable
2
2
  #
3
- # Mark your model with 'has_many_purgable' or 'has_one_purgable' to allow any has_many or has_one to be purgable
3
+ # Mark your model with 'has_many_purgable' or 'has_one_purgable' (both the same thing)
4
+ # to allow any has_many_attached or has_one_attached to be purgable.
5
+ #
4
6
  # Pass 'has_many_purgable :files, :avatar' to only allow the files and avatar to be purged.
7
+ #
5
8
  # Works with effective_bootstrap file_field to display a Delete file on save checkbox
6
- # to submit a _purge_attached array or association names to purge.
9
+ # to submit a _purge array of attachments to purge.
7
10
  #
8
- # You must permit the attribute _purge_attached: []
11
+ # You must permit the attribute _purge: []
9
12
 
10
13
  module HasManyPurgable
11
14
  extend ActiveSupport::Concern
@@ -30,13 +33,13 @@ module HasManyPurgable
30
33
  options = @has_many_purgable_options
31
34
  self.send(:define_method, :has_many_purgable_options) { options }
32
35
 
33
- attr_accessor :_purge_attached
36
+ attr_accessor :_purge
34
37
 
35
38
  effective_resource do
36
- _purge_attached :permitted_param
39
+ _purge :permitted_param
37
40
  end
38
41
 
39
- with_options(if: -> { _purge_attached.present? }) do
42
+ with_options(if: -> { _purge.present? }) do
40
43
  before_validation { has_many_purgable_mark_for_destruction }
41
44
  after_save { has_many_purgable_purge }
42
45
  end
@@ -62,7 +65,7 @@ module HasManyPurgable
62
65
 
63
66
  # As submitted by the form and permitted by our associations and options
64
67
  def has_many_purgable_attachments
65
- submitted = (Array(_purge_attached) - [nil, '', '0', ' ', 'false', 'f', 'off']).map(&:to_sym)
68
+ submitted = (Array(_purge) - [nil, '', '0', ' ', 'false', 'f', 'off']).map(&:to_sym)
66
69
  submitted & has_many_purgable_names
67
70
  end
68
71
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.2.10'.freeze
2
+ VERSION = '2.2.11'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.10
4
+ version: 2.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect