effective_resources 2.7.4 → 2.7.6

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: 0cce14845f98efb81d2fdd1ccf09e35827051f0eac750d9d8e379890d4b40ed3
4
+ data.tar.gz: 2e14c5298dd079ec455752023da6f7bc7202addeadb54e5629d01f1091e94ea7
5
5
  SHA512:
6
- metadata.gz: '0498afe80ac145df61098606e5b245e5b33ac901a70774d6a51601bfc1cfc1ec9c359c4e0805d6d8c7c5e7fa1b4d8b89904e99137764f0503f4b899b85f78065'
7
- data.tar.gz: e8361d0eed8f876bda4565c4d0c250607e447e59f6f7ce196283c44148adcfa863492aac59b92fc8b0b13cdeb521edc2a88f60417ca981b4eaf47ca0b0350221
6
+ metadata.gz: fe89a50199d6e6fa1d1d895b8d07fa7a7a767ea90b14f194ff7fb7002906ea86bd924ac8f7efdb8681fc036210f93a53beb809b9012fb3db16c20cd4458c7a0d
7
+ data.tar.gz: e1d8b4cbd15ccc3cf94bed31afceb31ac2b88bb58d53c40833b333bb4687abb2f1acb1772b1d0a1bd47aae4781255c17011bbf2320e8527abb0ab7ca60bc50cc
@@ -25,7 +25,7 @@ module Effective
25
25
  redirect_to_finish_wizard(options, params)
26
26
  end
27
27
  else
28
- flash.now[:danger] = options.delete(:error) || resource_flash(:danger, resource, action)
28
+ flash.now[:danger] ||= options.delete(:error) || resource_flash(:danger, resource, action)
29
29
  render_step(wizard_value(step), options)
30
30
  end
31
31
  end
@@ -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.6'.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.6
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-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails