Commit 2bfd92b6 by Jon Yurek

Fix errors caused by HasAttachedFile fix earlier

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