Sha256: b18f7dea573085615ce1e7e562b574825f1fdc3db3cfdf2ccf8a0f1535989771
Contents?: true
Size: 678 Bytes
Versions: 29
Compression:
Stored size: 678 Bytes
Contents
# frozen_string_literal: true 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
29 entries across 29 versions & 1 rubygems