Sha256: 821769e52910704930f283bdc0f753f78ee7f08f962533daa10409944d36d9c9

Contents?: true

Size: 525 Bytes

Versions: 25

Compression:

Stored size: 525 Bytes

Contents

# frozen_string_literal: true

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 "support/models/browser"

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
mongoid-8.1.8 spec/support/models/canvas.rb
mongoid-8.1.7 spec/support/models/canvas.rb
mongoid-8.1.6 spec/support/models/canvas.rb
mongoid-8.0.8 spec/support/models/canvas.rb
mongoid-8.1.5 spec/support/models/canvas.rb
mongoid-8.1.4 spec/support/models/canvas.rb
mongoid-8.0.7 spec/support/models/canvas.rb
mongoid-8.1.3 spec/support/models/canvas.rb
mongoid-8.1.2 spec/support/models/canvas.rb
mongoid-8.0.6 spec/support/models/canvas.rb
mongoid-7.5.4 spec/support/models/canvas.rb
mongoid-8.1.1 spec/support/models/canvas.rb
mongoid-8.0.5 spec/support/models/canvas.rb
mongoid-8.1.0 spec/support/models/canvas.rb
mongoid-7.5.3 spec/support/models/canvas.rb
mongoid-8.0.4 spec/support/models/canvas.rb
mongoid-8.0.3 spec/support/models/canvas.rb
mongoid-7.5.2 spec/support/models/canvas.rb
mongoid-8.0.2 spec/support/models/canvas.rb
mongoid-7.5.1 spec/support/models/canvas.rb