Sha256: 343b3a8b1a3134ea4b5800425b938e6b58206a5ab3a3e2c2d07ed43e15ef8ed0
Contents?: true
Size: 696 Bytes
Versions: 27
Compression:
Stored size: 696 Bytes
Contents
# frozen_string_literal: true # encoding: utf-8 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
27 entries across 27 versions & 2 rubygems