Module: Sequel::Plugins::ProcErrorHandling

Defined in:
lib/sequel_proc_error_handling.rb

Overview

Proc Error Handling is a plugin to help handle validation errors by providing context specific error handling as proc objects.

example:

filter_restricted = proc do |klass, values|
  if $!.message =~ /doesn't exist or access is restricted to it/
    values.delete_if { |k,v| klass.restricted_columns.include? k }
    :retry
  end
end

Foo.new(:restricted_column => 'value') # raises error
Foo.new(:restricted_column => 'value', filter_restricted) # No Error

This plugin is helpful when you don’t want to be changing a model’s error settings to acomodate unverified data in one area of the code, but still want the strict errors in a more secure area of the code.

Defined Under Namespace

Modules: ClassMethods, DatasetMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.apply(model) ⇒ Object



22
23
# File 'lib/sequel_proc_error_handling.rb', line 22

def self.apply(model)
end

.configure(model, &block) ⇒ Object



25
26
# File 'lib/sequel_proc_error_handling.rb', line 25

def self.configure(model,&block)
end