Module: Mongoid::Fields::ClassMethods
- Defined in:
- lib/custom_fields/extensions/mongoid/fields.rb
Instance Method Summary collapse
-
#replace_field(name, type, localize = false) ⇒ Serializable
Replace a field with a new type.
Instance Method Details
#replace_field(name, type, localize = false) ⇒ Serializable
Replace a field with a new type.
21 22 23 24 25 |
# File 'lib/custom_fields/extensions/mongoid/fields.rb', line 21 def replace_field(name, type, localize = false) # puts "fields[#{name}] = #{fields[name.to_s].inspect} / #{fields.keys.inspect}" # DEBUG remove_defaults(name) add_field(name, fields[name.to_s]..merge(type: type, localize: localize)) end |