better_form 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/better_form/builder.rb +3 -3
- data/lib/better_form/version.rb +1 -1
- metadata +2 -2
data/lib/better_form/builder.rb
CHANGED
@@ -52,7 +52,7 @@ module BetterForm
|
|
52
52
|
|
53
53
|
# Iterate over each validator for this attribute, and add the appropriate HTML5 data-* attributes
|
54
54
|
object._validators[attribute].each do |validator|
|
55
|
-
@
|
55
|
+
@validation_options = validator.options
|
56
56
|
validation = case validator
|
57
57
|
when ActiveModel::Validations::AcceptanceValidator
|
58
58
|
if validation_applies?
|
@@ -88,7 +88,7 @@ module BetterForm
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def validation_applies?
|
91
|
-
case @
|
91
|
+
case @validation_options[:on]
|
92
92
|
when :create then true if @object.new_record?
|
93
93
|
when :update then true if !@object.new_record?
|
94
94
|
else true
|
@@ -96,7 +96,7 @@ module BetterForm
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def validation_message(suffix = 'is invalid')
|
99
|
-
@
|
99
|
+
@validation_options[:message] ? @validation_options[:message] : "#{@attribute.to_s.humanize} #{suffix}"
|
100
100
|
end
|
101
101
|
end
|
102
102
|
end
|
data/lib/better_form/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: better_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.4.
|
5
|
+
version: 0.4.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Nicholas Firth-McCoy
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03-
|
13
|
+
date: 2011-03-28 00:00:00 +11:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|