err_supply 0.0.8 → 0.1.0
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.
- data/lib/err_supply/version.rb +1 -1
- data/lib/err_supply/view_helpers.rb +5 -2
- metadata +4 -4
data/lib/err_supply/version.rb
CHANGED
@@ -71,13 +71,16 @@ module ErrSupply
|
|
71
71
|
#---------------------------------------------
|
72
72
|
# apply options to children
|
73
73
|
#---------------------------------------------
|
74
|
-
|
74
|
+
|
75
|
+
# get keys
|
75
76
|
assoc_names = errors.keys.map { |k| k.to_s.split(".") }.select { |a| a.many? }.map { |a| a[0] }.compact.uniq
|
76
77
|
|
78
|
+
# if child has errors or is invalid (i.e., we prefer explicitly declared errrors),
|
79
|
+
# call function recursively and merge results
|
77
80
|
assoc_names.each do |assoc_name|
|
78
81
|
c_options = options[assoc_name.to_sym] || {}
|
79
82
|
obj.send("#{assoc_name}").each_with_index do |child, index|
|
80
|
-
|
83
|
+
if !child.errors.empty? or child.invalid?
|
81
84
|
c_prefix = "#{prefix}_#{assoc_name}_attributes_#{index}"
|
82
85
|
c_hash = err_supply_hash(child, c_options.merge({ :prefix => c_prefix }))
|
83
86
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: err_supply
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.8
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Coroutine
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-09-28 00:00:00 -05:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|