Commit 2bfd92b6 by Jon Yurek

Fix errors caused by HasAttachedFile fix earlier

parent 52543bde
......@@ -7,7 +7,7 @@ module Paperclip
def initialize(klass, name, options)
@klass = klass
@name = name
@options = Paperclip::Attachment.default_options.deep_merge(options)
@options = options
end
def define
......@@ -79,7 +79,8 @@ module Paperclip
end
def add_required_validations
if @options[:validate_media_type] != false
options = Paperclip::Attachment.default_options.deep_merge(@options)
if options[:validate_media_type] != false
name = @name
@klass.validates_media_type_spoof_detection name,
:if => ->(instance){ instance.send(name).dirty? }
......
......@@ -8,6 +8,6 @@ describe "Attachment Definitions" do
Dummy.do_not_validate_attachment_file_type :avatar
expected = {avatar: {path: "abc"}, other_attachment: {url: "123"}}
assert_equal expected, Dummy.attachment_definitions
expect(Dummy.attachment_definitions).to eq expected
end
end
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