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 collapse
- VERSION =
"1.4.0"
Class Method Summary collapse
-
.config ⇒ Object
Returns the global configuration, i.e., the singleton instance of Config.
-
.insert ⇒ Object
:nodoc:.
-
.setup {|config| ... } ⇒ Object
Initialization block is passed a global Config instance that can be used to configure SchemaValidations behavior.
Class Method Details
.config ⇒ Object
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 |
.insert ⇒ Object
: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 |
.setup {|config| ... } ⇒ Object
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 |