This commit is contained in:
Vasily Fedoseyev
2024-04-10 19:27:24 +03:00
parent 6647c5fa9c
commit 7cef86bb49
13 changed files with 33 additions and 21 deletions

View File

@@ -344,6 +344,6 @@ end
# Set it all up.
if Object.const_defined?("ActiveRecord")
ActiveRecord::Base.include(Paperclip)
ActiveSupport.on_load(:active_record) { include Paperclip }
File.include(Paperclip::Upfile)
end

View File

@@ -15,11 +15,11 @@ module Paperclip
def define_paperclip_callbacks(*callbacks)
define_callbacks(*callbacks.flatten, {})
callbacks.map(&:to_sym).each do |callback|
define_singleton_method "before_#{callback}" do |*args, &blk|
define_singleton_method :"before_#{callback}" do |*args, &blk|
set_callback(callback, :before, *args, &blk)
end
define_singleton_method "after_#{callback}" do |*args, &blk|
define_singleton_method :"after_#{callback}" do |*args, &blk|
set_callback(callback, :after, *args, &blk)
end
end