dao 5.5.2 → 5.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/dao.gemspec +1 -1
- data/lib/dao.rb +1 -1
- data/lib/dao/errors.rb +8 -0
- data/lib/dao/form.rb +1 -1
- data/test/errors_test.rb +10 -0
- metadata +2 -2
data/dao.gemspec
CHANGED
data/lib/dao.rb
CHANGED
data/lib/dao/errors.rb
CHANGED
@@ -123,7 +123,15 @@ module Dao
|
|
123
123
|
|
124
124
|
errors.each do |*argv|
|
125
125
|
msgs = Array(argv.pop)
|
126
|
+
|
127
|
+
# ref: support for key-style of https://github.com/glooko/mongoid-embedded-errors
|
128
|
+
#key = Array(argv.pop).flatten.compact.join('.')
|
129
|
+
#key = key.to_s.split('.')
|
130
|
+
#key.map!{|k| k =~ /\[(\d+)\]/ ? $1 : k}
|
131
|
+
#key = prefix + key
|
132
|
+
|
126
133
|
key = prefix + Array(argv.pop)
|
134
|
+
|
127
135
|
msgs.each{|msg| add(Array(options[:key] || key), msg, options)}
|
128
136
|
end
|
129
137
|
end
|
data/lib/dao/form.rb
CHANGED
@@ -310,7 +310,7 @@ module Dao
|
|
310
310
|
value_for[false] ||= '0'
|
311
311
|
|
312
312
|
hidden_options =
|
313
|
-
options.dup.tap{|o| o.delete(
|
313
|
+
options.dup.tap{|o| [:checked, :required, :disabled].each{|k| o.delete(k)}}
|
314
314
|
|
315
315
|
tagz{
|
316
316
|
input_(options_for(hidden_options, :type => :hidden, :name => name, :value => value_for[false])){}
|
data/test/errors_test.rb
CHANGED
@@ -45,6 +45,16 @@ Testing Dao::Errors do
|
|
45
45
|
assert compress(actual) == compress(expected)
|
46
46
|
end
|
47
47
|
|
48
|
+
=begin
|
49
|
+
testing 'that `nested` errors `nest`' do
|
50
|
+
e = Dao::Errors.new
|
51
|
+
|
52
|
+
e.relay 'foo.bar' => 'is fucked'
|
53
|
+
|
54
|
+
p e.to_hash
|
55
|
+
assert e.to_hash == {'foo' => {'bar' => 'is fucked'}}
|
56
|
+
end
|
57
|
+
=end
|
48
58
|
|
49
59
|
|
50
60
|
protected
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dao
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-01-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|