Module: JSONdb::Validations::Records
Overview
Types
Constant Summary collapse
- FieldsToNotVerify =
['id', 'created_at', 'updated_at']
Constants included from Types
Instance Method Summary collapse
Methods included from Types
#allowed_type?, #validate_type
Methods included from Logger
#allowed_log_level?, #log, #log_enabled?, #log_this?
Instance Method Details
#record_validates?(table_name, record) ⇒ Boolean
120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/jsondb/validations.rb', line 120 def record_validates?(table_name, record) table_fields = JSONdb.fields[table_name] table_fields.each do |field_name, field_values| if FieldsToNotVerify.include?(field_name) == false actual_value = record.send field_name.to_sym return false if field_values.nullable == false and actual_value.nil? return false if validate_type(field_values.type, actual_value) == false end end return true # true if no previous invalidation end |