module Model
Mixin module for all model classes.
Public Class Methods
define_field_type( type, method_name )
click to toggle source
# File lib/aerogel/core/db/model.rb, line 10 def self.define_field_type( type, method_name ) redefined_field_types[type] = method_name.to_sym end
field( name, opts = {} )
click to toggle source
Defines native Mongoid field or calls field type handler in case of redefined field types.
# File lib/aerogel/core/db/model.rb, line 45 def self.field( name, opts = {} ) if opts[:type] && Model.redefined_field_types.key?( opts[:type] ) self.send Model.redefined_field_types[opts[:type]], name, opts else self.define_field_mongoid( name, opts ) end end
Also aliased as: define_field_mongoid
redefined_field_types()
click to toggle source
# File lib/aerogel/core/db/model.rb, line 6 def self.redefined_field_types @redefined_field_types ||= {} end