class CallbackDeveloper
Public Class Methods
callback_object(callback_method)
click to toggle source
# File activerecord/test/cases/callbacks_test.rb, line 22 def callback_object(callback_method) klass = Class.new klass.send(:define_method, callback_method) do |model| model.history << [callback_method, :object] end klass.new end
callback_proc(callback_method)
click to toggle source
# File activerecord/test/cases/callbacks_test.rb, line 11 def callback_proc(callback_method) Proc.new { |model| model.history << [callback_method, :proc] } end
define_callback_method(callback_method)
click to toggle source
# File activerecord/test/cases/callbacks_test.rb, line 15 def define_callback_method(callback_method) define_method(callback_method) do history << [callback_method, :method] end send(callback_method, :"#{callback_method}") end
Public Instance Methods
history()
click to toggle source
# File activerecord/test/cases/callbacks_test.rb, line 39 def history @history ||= [] end