Как установить тип данных для хэша в рельсах (монгоид)

У меня есть схема mongoDB примерно так

new Schema({
 productDetail: [ {
                productYear:     String,
                productNumber:   String,
                productType:     [ { type: Schema.ObjectId, ref: 'type' } ]
              } ],
 created_at: string
            )}

Пытаясь сделать то же самое в Rails и mongoid, я не смог добавить дочерние элементы и типы данных в объект Hash.

class Product
include Mongoid::Document
has_many :types
 field :productDetail, type: Hash
 field :created_at, type: string
end

это вообще возможно?


person sureshvignesh    schedule 21.02.2017    source источник
comment
вы смотрели на stackoverflow.com/a/36477920/1380867   -  person MZaragoza    schedule 21.02.2017