Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bhbryant committed Mar 22, 2012
1 parent 4485243 commit 6b446e8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/paperclip.rb
Expand Up @@ -160,6 +160,7 @@ class InfiniteInterpolationError < PaperclipError #:nodoc:
module Glue
def self.included base #:nodoc:
base.extend ClassMethods
base.class_attribute :attachment_definitions
if base.respond_to?("set_callback")
base.send :include, Paperclip::CallbackCompatability::Rails3
else
Expand Down Expand Up @@ -235,7 +236,13 @@ module ClassMethods
def has_attached_file name, options = {}
include InstanceMethods

self._attachment_definitions = {} if attachment_definitions.nil?
if attachment_definitions.nil?
self.attachment_definitions = {}
else
self.attachment_definitions = self.attachment_definitions.dup
end


attachment_definitions[name] = {:validations => []}.merge(options)

after_save :save_attached_files
Expand Down Expand Up @@ -381,7 +388,7 @@ def validates_attachment_content_type name, options = {}
# Returns the attachment definitions defined by each call to
# has_attached_file.
def attachment_definitions
self._attachment_definitions
self.attachment_definitions
end
end

Expand Down

0 comments on commit 6b446e8

Please sign in to comment.