Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/validations.rb

Constant Summary collapse

@@validations =
{}

Class Method Summary collapse

Class Method Details

.new_validationsObject

Creates an object and returns all validations without persisting



111
112
113
114
115
116
117
# File 'lib/validations.rb', line 111

def new_validations
   object = new # this triggers the validations so that they are captured
   schema = schema_validations
   object.instance_variable_set(:@validations, schema.merge(validations) )
   unset_aliases
   object
end

.schema_validationsObject

Returns the schema validations defined in the migration



120
121
122
# File 'lib/validations.rb', line 120

def schema_validations
    FlexScaffold::Validations.new(name).get_schema_info
end