attached 0.0.6 → 0.0.7
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/attached.rb +3 -3
- metadata +2 -2
data/lib/attached.rb
CHANGED
@@ -104,15 +104,15 @@ module Attached
|
|
104
104
|
|
105
105
|
def validates_attached_size(name, options = {})
|
106
106
|
|
107
|
-
message = options[:message] || "size must be between :minimum and :maximum
|
107
|
+
message = options[:message] || "size must be between :minimum and :maximum"
|
108
108
|
|
109
109
|
minimum = options[:minimum] || options[:in] && options[:in].first || (0.0 / 1.0)
|
110
110
|
maximum = options[:maximum] || options[:in] && options[:in].last || (1.0 / 0.0)
|
111
111
|
|
112
112
|
range = minimum..maximum
|
113
113
|
|
114
|
-
message.gsub!(/:minimum/, minimum
|
115
|
-
message.gsub!(/:maximum/, maximum
|
114
|
+
message.gsub!(/:minimum/, number_to_human_size(minimum))
|
115
|
+
message.gsub!(/:maximum/, number_to_human_size(maximum))
|
116
116
|
|
117
117
|
validates_inclusion_of :"#{name}_size", :in => range, :message => message,
|
118
118
|
:if => options[:if], :unless => options[:unless]
|