lib/declare_schema/model.rb
# Declare named field with a type and an arbitrary set of
# arguments. The arguments are forwarded to the #field_added
# callback, allowing custom metadata to be added to field
# declarations.
Declare named field with a type and an arbitrary set of
arguments. The arguments are forwarded to the #field_added
callback, allowing custom metadata to be added to field
declarations.
Declare named field with a type and an arbitrary set of arguments . The arguments are forwarded to the #field_added callback allowing custom metadata to be added to field declarations .
def declare_field(name, type, *args, **options)
        try(:field_added, name, type, args, options)
        _add_serialize_for_field(name, type, options)
        _add_formatting_for_field(name, type)
        _add_validations_for_field(name, type, args, options)
        _add_index_for_field(name, args, options)
        field_specs[name] = ::DeclareSchema::Model::FieldSpec.new(self, name, type, position: field_specs.size, **options)
        attr_order << name unless attr_order.include?(name)
      end
def declare_field ( name , type , * args , ** options ) try ( :field_added , name , type , args , options ) _add_serialize_for_field ( name , type , options ) _add_formatting_for_field ( name , type ) _add_validations_for_field ( name , type , args , options ) _add_index_for_field ( name , args , options ) field_specs [ name ] = :: DeclareSchema :: Model :: FieldSpec . new ( self , name , type , position : field_specs . size , ** options ) attr_order << name unless attr_order . include? ( name ) end
Declare named field with a type and an arbitrary set of
arguments.
Declare named field with a type and an arbitrary set of arguments .
name
<not_specific>
type
<not_specific>
args
<not_specific>
options
<not_specific>