Sha256: a910860e733a100b5b52145fdba588915b7b76cd06be28406768f0d67ca824c5

Contents?: true

Size: 539 Bytes

Versions: 13

Compression:

Stored size: 539 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

class Canvas
  include Mongoid::Document
  field :name
  embeds_many :shapes
  embeds_one :writer
  embeds_one :palette

  field :foo, type: String, default: ->{ "original" }

  has_many :comments, as: :commentable

  accepts_nested_attributes_for :shapes
  accepts_nested_attributes_for :writer

  def render
    shapes.each { |shape| render }
  end

  class Test < Canvas

    field :foo, type: String, overwrite: true, default: ->{ "overridden" }
  end
end

require "app/models/browser"

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
mongoid-7.1.11 spec/app/models/canvas.rb
mongoid-7.1.10 spec/app/models/canvas.rb
mongoid-7.1.9 spec/app/models/canvas.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongoid-7.1.7/spec/app/models/canvas.rb
mongoid-7.1.8 spec/app/models/canvas.rb
mongoid-7.1.7 spec/app/models/canvas.rb
mongoid-7.1.6 spec/app/models/canvas.rb
mongoid-7.1.5 spec/app/models/canvas.rb
mongoid-7.1.4 spec/app/models/canvas.rb
mongoid-7.1.2 spec/app/models/canvas.rb
mongoid-7.1.1 spec/app/models/canvas.rb
mongoid-7.1.0 spec/app/models/canvas.rb
mongoid-7.1.0.rc0 spec/app/models/canvas.rb