Module: Milton::Uploading::ClassMethods
- Defined in:
- lib/milton/uploading.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
4 5 6 |
# File 'lib/milton/uploading.rb', line 4 def self.extended(base) base.setup_callbacks end |
Instance Method Details
#after_file_saved(&block) ⇒ Object
20 21 22 |
# File 'lib/milton/uploading.rb', line 20 def after_file_saved(&block) write_inheritable_array(:after_file_saved, [block]) end |
#before_file_saved(&block) ⇒ Object
16 17 18 |
# File 'lib/milton/uploading.rb', line 16 def before_file_saved(&block) write_inheritable_array(:before_file_saved, [block]) end |
#setup_callbacks ⇒ Object
8 9 10 11 12 13 |
# File 'lib/milton/uploading.rb', line 8 def setup_callbacks # Rails 2.1 fix for callbacks define_callbacks(:before_file_saved, :after_file_saved) if defined?(::ActiveSupport::Callbacks) after_save :save_uploaded_file after_file_saved :create_derivatives if @after_create_callbacks.delete(:create_derivatives) end |