Skip to content

Commit

Permalink
use class_attribute instead of class_inheritable_attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Xie committed Apr 3, 2011
1 parent be62ab4 commit e0ea10a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/paperclip.rb
Expand Up @@ -160,6 +160,8 @@ 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 +237,7 @@ module ClassMethods
def has_attached_file name, options = {}
include InstanceMethods

write_inheritable_attribute(:attachment_definitions, {}) if attachment_definitions.nil?
self.attachment_definitions = {} if attachment_definitions.nil?
attachment_definitions[name] = {:validations => []}.merge(options)

after_save :save_attached_files
Expand Down Expand Up @@ -339,12 +341,6 @@ def validates_attachment_content_type name, options = {}
end
end
end

# Returns the attachment definitions defined by each call to
# has_attached_file.
def attachment_definitions
read_inheritable_attribute(:attachment_definitions)
end
end

module InstanceMethods #:nodoc:
Expand Down

0 comments on commit e0ea10a

Please sign in to comment.