Sha256: 1f76527e1219e0e2b26005a67031fe3ec461dcfe403b7d90f41f8c9e11b853f8
Contents?: true
Size: 682 Bytes
Versions: 10
Compression:
Stored size: 682 Bytes
Contents
require 'active_support/concern' module Ardm module ActiveRecord module Hooks extend ActiveSupport::Concern module ClassMethods def before(event, meth=nil, &block) _ardm_hook(:before, event, meth, &block) end def after(event, meth=nil, &block) _ardm_hook(:after, event, meth, &block) end def _ardm_hook(order, event, meth=nil, &block) if event.to_sym == :valid? event = "validation" end if meth.nil? send "#{order}_#{event}", &block else send "#{order}_#{event}", meth end end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems