effective_resources 2.7.4 → 2.7.5

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: ddbc305a4fe6da53cc0d4a6bdb95a6bcde56fd64f9c2ce714bec57e850eb4936
4
- data.tar.gz: cdc5008daa38b79bfb3a7e3f64e13c81123b6587c62ca4f803144ea07438eb92
3
+ metadata.gz: 81e95260653fd5965100cb1472f50ed8d5132c1fb37574b8f726c62fbb6b7788
4
+ data.tar.gz: 8a17f54272e74b3ffdeb7ecd14651d6506cb1f4051e15c30429064ca7df02ee9
5
5
  SHA512:
6
- metadata.gz: '0498afe80ac145df61098606e5b245e5b33ac901a70774d6a51601bfc1cfc1ec9c359c4e0805d6d8c7c5e7fa1b4d8b89904e99137764f0503f4b899b85f78065'
7
- data.tar.gz: e8361d0eed8f876bda4565c4d0c250607e447e59f6f7ce196283c44148adcfa863492aac59b92fc8b0b13cdeb521edc2a88f60417ca981b4eaf47ca0b0350221
6
+ metadata.gz: 2fd66ded174e4688bd8a432da093828e7f58444269b3ac40a9fb44cd545792137f6942a57d5cfa8190f04e375979ffe345e3800e90b9218e3121a7084b41626d
7
+ data.tar.gz: d9af4ef456b4de382ff1e947f432e2aa676dc56dfa0ec418735051b9b1bbcffe89c27c82d0613324c79a3829dccecca68720ef2e8052257205954bd6f6d021a2
@@ -76,6 +76,9 @@ module ActsAsStatused
76
76
  # was_approved?
77
77
  define_method("was_#{sym}?") { send(sym_at).present? }
78
78
 
79
+ # just_approved?
80
+ define_method("just_#{sym}?") { status == sym.to_s && status_was != sym.to_s }
81
+
79
82
  # approved_at
80
83
  define_method(sym_at) { self[sym_at.to_s] || status_steps[sym_at] }
81
84
 
@@ -29,6 +29,10 @@ module Effective
29
29
  end
30
30
  end
31
31
 
32
+ def belong_tos_names_attributes
33
+ belong_tos.inject({}) { |h, ass| h[ass.name] = [:belongs_to]; h }
34
+ end
35
+
32
36
  def has_manys_attributes
33
37
  has_manys_ids.inject({}) { |h, ass| h[ass] = [:array]; h }
34
38
  end
@@ -82,6 +86,7 @@ module Effective
82
86
  end
83
87
 
84
88
  # All table attributes. includes primary_key and belongs_tos
89
+ # THINK THIS IS DEPRECATED
85
90
  def table_attributes
86
91
  attributes = (klass.new().attributes rescue nil)
87
92
  return {} unless attributes
@@ -123,6 +128,14 @@ module Effective
123
128
  sort ? sort_by_model_attributes(attributes) : attributes
124
129
  end
125
130
 
131
+ # Similar to klass_attributes
132
+ # Used by table_builder
133
+ def resource_attributes
134
+ belong_tos_names_attributes
135
+ .merge(klass_attributes(sort: true))
136
+ .merge(effective_addresses_attributes)
137
+ end
138
+
126
139
  private
127
140
 
128
141
  def sort_by_model_attributes(attributes)
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.7.4'.freeze
2
+ VERSION = '2.7.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.4
4
+ version: 2.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-18 00:00:00.000000000 Z
11
+ date: 2023-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails