public
Description: Paperclip File Management Plugin
Homepage: http://www.thoughtbot.com/projects/paperclip
Clone URL: git://github.com/thoughtbot/paperclip.git
Removed the eval() call when parsing messages for validations.
jyurek (author)
Mon May 05 13:58:59 -0700 2008
commit  1b099cda9e7ca67715dee7023ea3f9f7ab489dc1
tree    a297b35e014965200c3834208a075a13c53bab2b
parent  69525425d37d75d4c7330d25558def1604107a3b
...
144
145
146
147
 
148
149
150
...
158
159
160
161
 
162
163
164
...
144
145
146
 
147
148
149
150
...
158
159
160
 
161
162
163
164
0
@@ -144,7 +144,7 @@ module Paperclip
0
     # * +in+: a Range of bytes (i.e. +1..1.megabyte+),
0
     # * +less_than+: equivalent to :in => 0..options[:less_than]
0
     # * +greater_than+: equivalent to :in => options[:greater_than]..Infinity
0
- # * +message+: error message to display, use #{min} and #{max} as replacements
0
+ # * +message+: error message to display, use :min and :max as replacements
0
     def validates_attachment_size name, options = {}
0
       attachment_definitions[name][:validations] << lambda do |attachment, instance|
0
         unless options[:greater_than].nil?
0
@@ -158,7 +158,7 @@ module Paperclip
0
           max = options[:in].last
0
           
0
           if options[:message]
0
- eval('"' + options[:message] + '"')
0
+ options[:message].gsub(/:min/, min.to_s).gsub(/:max/, max.to_s)
0
           else
0
             "file size is not between #{min} and #{max} bytes."
0
           end

Comments

    No one has commented yet.