Skip to content
This repository
Browse code

Check for existance of class_attribute setter

  • Loading branch information...
commit 4b795307096457f23816d4127465ebd6d7b2a30e 1 parent 6fca437
Prem Sichanugrist authored February 17, 2012

Showing 1 changed file with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. 6  lib/paperclip.rb
6  lib/paperclip.rb
@@ -324,7 +324,11 @@ def has_attached_file name, options = {}
324 324
           write_inheritable_attribute(:attachment_definitions, {})
325 325
         end
326 326
       else
327  
-        self.attachment_definitions = self.attachment_definitions.dup
  327
+        if respond_to?(:class_attribute)
  328
+          self.attachment_definitions = self.attachment_definitions.dup
  329
+        else
  330
+          write_inheritable_attribute(:attachment_definitions, self.attachment_definitions.dup)
  331
+        end
328 332
       end
329 333
 
330 334
       attachment_definitions[name] = Paperclip::AttachmentOptions.new(options)

3 notes on commit 4b79530

Joshua Clayton

class_attribute was introduced in ActiveSupport 2.3.12; does it make sense to just bump that gem dependency?

Prem Sichanugrist
Collaborator

No, let's keep it that way for now. I'm going to tear it out anyway after next week (I.e. #728)

Prem Sichanugrist
Collaborator

(because there're some project that still use rails <= 2.3.12)

Please sign in to comment.
Something went wrong with that request. Please try again.