validates_associated_bubbling 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: 902bdba674c1a1dfe67a2998ee92ee0c12fbf76b
4
- data.tar.gz: 6785216b16f078c176c62019602815f2d436e5ea
3
+ metadata.gz: 1b90bf0c41406bf11f51239ad971ce28166d9205
4
+ data.tar.gz: 4a9e29b2094983d9c0900f852f15a1d94f84a1d3
5
5
  SHA512:
6
- metadata.gz: aa10d179a8bad23beec70733d947c5f70c484d1524258302fce85af4e80b2bba8fec82578d1c3f1fd6f28b2f5e19f7d9db6c1738603b99eef65f947a25a2a80b
7
- data.tar.gz: 41ffa3226ef7385ff748b3823ad2769115814f3fdc1f033ae5c4efee97ba09593c46c926cfe4a17214ddf3f393194f1f172a9a35742802dcb0d20fc5a63e9976
6
+ metadata.gz: 100ffd48bbda2a5c151919bace212a535e120602427ffe974bad6e4022cdb77a1da0dc78e97794918169455be76592deb7dfd6de84edc23b2d1d754865c7d085
7
+ data.tar.gz: 272823f727ccc82e997711046c58f80e2f868f501ca91889b368a6c3099f8951532bc155576dfa0f6772f8c13400552366c1235ff9ab4160bf13f06483b4855a
@@ -12,11 +12,26 @@ module ActiveRecord
12
12
  end
13
13
  end
14
14
  end
15
+
16
+ class PatientEvaluationAssociatedBubblingValidator < ActiveModel::EachValidator
17
+ def validate_each(record, attribute, value)
18
+ Array(value).reject(&:valid?).each do |v|
19
+ v.errors.each do |k, v|
20
+ record.errors.add k, v, options.merge(value: value)
21
+ end
22
+ end
23
+ end
24
+ end
15
25
 
16
26
  module ClassMethods
17
27
  def validates_associated_bubbling(*attr_names)
18
28
  validates_with AssociatedBubblingValidator, _merge_attributes(attr_names)
19
29
  end
30
+
31
+ def patient_evaluation_validates_associated_bubbling(*attr_names)
32
+ validates_with PatientEvaluationAssociatedBubblingValidator, _merge_attributes(attr_names)
33
+ end
20
34
  end
21
35
  end
22
36
  end
37
+
@@ -1,3 +1,3 @@
1
1
  module ValidatesAssociatedBubbling
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validates_associated_bubbling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego Salazar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-12 00:00:00.000000000 Z
11
+ date: 2016-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  requirements: []
77
77
  rubyforge_project:
78
- rubygems_version: 2.4.3
78
+ rubygems_version: 2.4.6
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: EachValidator that adds a parent model's association's validation errors