Module: Sequel::Plugins::ProcErrorHandling::ClassMethods

Defined in:
lib/sequel_proc_error_handling.rb

Instance Method Summary collapse

Instance Method Details

#create(values = {}, *error_proc, &block) ⇒ Object



114
115
116
# File 'lib/sequel_proc_error_handling.rb', line 114

def create(values = {}, *error_proc, &block)
  new(values,*error_proc, &block).save *error_proc
end

#on_error(&block) ⇒ Object



118
119
120
# File 'lib/sequel_proc_error_handling.rb', line 118

def on_error(&block)
  @peh_error_block = block
end

#peh_error_occured(model) ⇒ Object



122
123
124
125
126
127
128
# File 'lib/sequel_proc_error_handling.rb', line 122

def peh_error_occured(model)
  if @peh_error_block
    @peh_error_block.call(model)
  elsif superclass.respond_to? :peh_error_occured
    superclass.peh_error_occured(model)
  end
end