Module: Hammock::ActiveRecordPatches
- Defined in:
- lib/hammock/monkey_patches/active_record.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Constant Summary collapse
- MixInto =
ActiveRecord::Base
Class Method Summary collapse
-
.included(base) ⇒ Object
:nodoc:.
Class Method Details
.included(base) ⇒ Object
:nodoc:
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/hammock/monkey_patches/active_record.rb', line 5 def self.included base # :nodoc: base.send :include, InstanceMethods base.send :extend, ClassMethods # TODO maybe include in the metaclass instead of extending the class? %w[before_undestroy after_undestroy].each {|callback_name| base.define_callbacks callback_name # base.send :define_method, callback_name, lambda { } } base.class_eval { before_create :set_new_or_deleted_before_save before_undestroy :set_new_or_deleted_before_save } end |