<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>.gitignore</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -116,41 +116,47 @@ module Technoweenie # :nodoc:
         content_types.include?(content_type)
       end
 
-      # Callback after an image has been resized.
-      #
-      #   class Foo &lt; ActiveRecord::Base
-      #     acts_as_attachment
-      #     after_resize do |record, img| 
-      #       record.aspect_ratio = img.columns.to_f / img.rows.to_f
-      #     end
-      #   end
-      def after_resize(&amp;block)
-        write_inheritable_array(:after_resize, [block])
-      end
+      if defined?(::ActiveSupport::Callbacks)
+        def self.extended(base)
+          base.define_callbacks :after_resize, :after_attachment_saved, :before_thumbnail_saved
+        end
+      else
+        # Callback after an image has been resized.
+        #
+        #   class Foo &lt; ActiveRecord::Base
+        #     acts_as_attachment
+        #     after_resize do |record, img| 
+        #       record.aspect_ratio = img.columns.to_f / img.rows.to_f
+        #     end
+        #   end
+        def after_resize(&amp;block)
+          write_inheritable_array(:after_resize, [block])
+        end
 
-      # Callback after an attachment has been saved either to the file system or the DB.
-      # Only called if the file has been changed, not necessarily if the record is updated.
-      #
-      #   class Foo &lt; ActiveRecord::Base
-      #     acts_as_attachment
-      #     after_attachment_saved do |record|
-      #       ...
-      #     end
-      #   end
-      def after_attachment_saved(&amp;block)
-        write_inheritable_array(:after_attachment_saved, [block])
-      end
+        # Callback after an attachment has been saved either to the file system or the DB.
+        # Only called if the file has been changed, not necessarily if the record is updated.
+        #
+        #   class Foo &lt; ActiveRecord::Base
+        #     acts_as_attachment
+        #     after_attachment_saved do |record|
+        #       ...
+        #     end
+        #   end
+        def after_attachment_saved(&amp;block)
+          write_inheritable_array(:after_attachment_saved, [block])
+        end
 
-      # Callback before a thumbnail is saved.  Use this to pass any necessary extra attributes that may be required.
-      #
-      #   class Foo &lt; ActiveRecord::Base
-      #     acts_as_attachment
-      #     before_thumbnail_saved do |record, thumbnail|
-      #       ...
-      #     end
-      #   end
-      def before_thumbnail_saved(&amp;block)
-        write_inheritable_array(:before_thumbnail_saved, [block])
+        # Callback before a thumbnail is saved.  Use this to pass any necessary extra attributes that may be required.
+        #
+        #   class Foo &lt; ActiveRecord::Base
+        #     acts_as_attachment
+        #     before_thumbnail_saved do |record, thumbnail|
+        #       ...
+        #     end
+        #   end
+        def before_thumbnail_saved(&amp;block)
+          write_inheritable_array(:before_thumbnail_saved, [block])
+        end
       end
 
       # Get the thumbnail class, which is the current attachment class by default.
@@ -397,10 +403,30 @@ module Technoweenie # :nodoc:
             result = callback.call(self, arg)
             return false if result == false
           end
+          result
+        end
 
-          return result
+        # Rather ugly monkey-patch of AS::Callbacks to support taking an arg
+        if defined?(::ActiveSupport::Callbacks)
+          def callbacks_for(method) #:nodoc: compatibility method
+            self.class.send(&quot;#{method}_callback_chain&quot;)
+          end
+          class ::ActiveSupport::Callbacks::Callback
+            # Make callbacks accept arguments, but only pass them along to procs for now
+            def call(object, *args)
+              if should_run_callback?(object)
+                case method
+                when Proc
+                  args = [object, *args].compact
+                  method.call(*args)
+                else
+                  evaluate_method(method, object)
+                end
+              end
+            end
+          end
         end
-        
+
         # Removes the thumbnails for the attachment, if it has any
         def destroy_thumbnails
           self.thumbnails.each { |thumbnail| thumbnail.destroy } if thumbnailable?</diff>
      <filename>lib/technoweenie/attachment_fu.rb</filename>
    </modified>
    <modified>
      <diff>@@ -162,7 +162,7 @@ class RmagickTest &lt; Test::Unit::TestCase
       assert_equal 'rails_thumb.png', attachment.thumbnails.first.filename
       assert_equal attachment.thumbnails.first.full_filename, attachment.full_filename(attachment.thumbnails.first.thumbnail),
         &quot;#full_filename does not use thumbnail class' path.&quot;
-      assert_equal attachment.destroy attachment
+      assert_equal attachment.destroy, attachment
     end
     
     test_against_subclass :test_should_use_thumbnail_subclass, ImageWithThumbsClassFileAttachment</diff>
      <filename>test/processors/rmagick_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b0da755535a196c8a12e4f0c58cfc5cafda4f6e2</id>
    </parent>
  </parents>
  <author>
    <name>Nick</name>
    <email>nick@nicksieger.com</email>
  </author>
  <url>http://github.com/nicksieger/attachment_fu/commit/ee8474831d3181596220f2b970a707730b851950</url>
  <id>ee8474831d3181596220f2b970a707730b851950</id>
  <committed-date>2008-03-04T09:15:36-08:00</committed-date>
  <authored-date>2008-03-04T09:15:36-08:00</authored-date>
  <message>- Fixing edge callback changes issue (see http://dev.rubyonrails.org/changeset/8664)
- Fix rmagick assertion</message>
  <tree>b1157b674c4bbfbe2fc03f6108e11030b7b5a77c</tree>
  <committer>
    <name>Nick</name>
    <email>nick@nicksieger.com</email>
  </committer>
</commit>
