Module: SchemaValidations
- Defined in:
- lib/schema_validations.rb,
lib/schema_validations/railtie.rb,
lib/schema_validations/version.rb,
lib/schema_validations/active_record/validations.rb
Defined Under Namespace
Modules: ActiveRecord Classes: Config, Railtie
Constant Summary
- VERSION =
"0.1.0"
Class Method Summary (collapse)
-
+ (Object) config
Returns the global configuration, i.e., the singleton instance of Config.
-
+ (Object) insert
:nodoc:.
-
+ (Object) setup {|config| ... }
Initialization block is passed a global Config instance that can be used to configure SchemaValidations behavior.
Class Method Details
+ (Object) config
Returns the global configuration, i.e., the singleton instance of Config
79 80 81 |
# File 'lib/schema_validations.rb', line 79 def self.config @config ||= Config.new end |
+ (Object) insert
:nodoc:
96 97 98 99 100 |
# File 'lib/schema_validations.rb', line 96 def self.insert #:nodoc: return if @inserted @inserted = true ::ActiveRecord::Base.extend SchemaValidations::ActiveRecord::Validations end |
+ (Object) setup {|config| ... }
Initialization block is passed a global Config instance that can be used to configure SchemaValidations behavior. E.g., if you want to disable automation creation validations put the following in config/initializers/schema_validations.rb :
SchemaValidations.setup do |config|
config.auto_create = false
end
92 93 94 |
# File 'lib/schema_validations.rb', line 92 def self.setup # :yields: config yield config end |