Commit 44b02fac by Jon Yurek

Don't use #present? since it's not there until 2.2

parent 71500168
...@@ -350,7 +350,7 @@ module Paperclip ...@@ -350,7 +350,7 @@ module Paperclip
validation_options = options.dup validation_options = options.dup
allowed_types = [validation_options[:content_type]].flatten allowed_types = [validation_options[:content_type]].flatten
validates_each(:"#{name}_content_type", validation_options) do |record, attr, value| validates_each(:"#{name}_content_type", validation_options) do |record, attr, value|
if !allowed_types.any?{|t| t === value } && value.present? if !allowed_types.any?{|t| t === value } && !(value.nil? || value.blank?)
if record.errors.method(:add).arity == -2 if record.errors.method(:add).arity == -2
message = options[:message] || "is not one of #{allowed_types.join(", ")}" message = options[:message] || "is not one of #{allowed_types.join(", ")}"
record.errors.add(:"#{name}_content_type", message) record.errors.add(:"#{name}_content_type", message)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment