Sha256: 2e88392c72194576ad74c7d85ab8e7b60bce5b254066d88c098ac563dd792b32

Contents?: true

Size: 473 Bytes

Versions: 22

Compression:

Stored size: 473 Bytes

Contents

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, default: ->{ "overridden" }
  end
end

require "app/models/browser"

Version data entries

22 entries across 22 versions & 6 rubygems

Version Path
mongoid-versioning-0.1.0 spec/app/models/canvas.rb
mongoid-paranoia-0.1.0 spec/app/models/canvas.rb