Module: ForeignKeyValidation

Defined in:
lib/foreign_key_validation.rb,
lib/foreign_key_validation/errors.rb,
lib/foreign_key_validation/filter.rb,
lib/foreign_key_validation/version.rb,
lib/foreign_key_validation/collector.rb,
lib/foreign_key_validation/validator.rb,
lib/foreign_key_validation/model_extension.rb

Defined Under Namespace

Modules: Errors, ModelExtension Classes: Collector, Filter, Validator

Constant Summary collapse

DEFAULT_CONFIG =
{
  inject_subclasses: true,
  validate_against: :user,
  error_message: lambda { |key, reflection_name, object|
    "#{key} of #{reflection_name} does not match #{object.class.name.tableize} #{key}."
  }
}
VERSION =
"1.1.2"

Class Method Summary collapse

Class Method Details

.configurationObject



25
26
27
# File 'lib/foreign_key_validation.rb', line 25

def configuration
  @configuration ||= OpenStruct.new(DEFAULT_CONFIG)
end

.configure {|configuration| ... } ⇒ Object

Yields:



21
22
23
# File 'lib/foreign_key_validation.rb', line 21

def configure
  yield configuration
end

.reset_configurationObject



29
30
31
# File 'lib/foreign_key_validation.rb', line 29

def reset_configuration
  @configuration = nil
end