Sha256: 02206d658948ac7b52b301ef8db7e8d9780a497cf7feec58e3f3aa7402abde48
Contents?: true
Size: 647 Bytes
Versions: 14
Compression:
Stored size: 647 Bytes
Contents
class Animal include Mongoid::Document field :_id, type: String, overwrite: true, default: ->{ name.try(:parameterize) } field :name field :height, type: Integer field :weight, type: Integer field :tags, type: Array embedded_in :person embedded_in :circus, class_name: 'Circus' # class_name is necessary because ActiveRecord think the singular of Circus # is Circu validates_format_of :name, without: /\$\$\$/ accepts_nested_attributes_for :person def tag_list tags.join(", ") end def tag_list=(_tag_list) self.tags = _tag_list.split(",").map(&:strip) end end
Version data entries
14 entries across 14 versions & 1 rubygems