Sha256: 62616d7c77e383f4c6535489360bc6ee07318ffee4572f0c395e81d1ba6c4761

Contents?: true

Size: 1.48 KB

Versions: 9

Compression:

Stored size: 1.48 KB

Contents

# frozen_string_literal: true

module TouchableSpec
  module Embedded
    class Building
      include Mongoid::Document
      include Mongoid::Timestamps

      field :title, type: String

      embeds_many :entrances, class_name: "TouchableSpec::Embedded::Entrance"
      embeds_many :floors, class_name: "TouchableSpec::Embedded::Floor"
    end

    class Entrance
      include Mongoid::Document
      include Mongoid::Timestamps

      embedded_in :building, touch: false, class_name: "TouchableSpec::Embedded::Building"

      field :last_used_at, type: Time
    end

    class Floor
      include Mongoid::Document
      include Mongoid::Timestamps

      field :level, type: Integer

      embedded_in :building, touch: true, class_name: "TouchableSpec::Embedded::Building"
    end
  end

  module Referenced
    class Building
      include Mongoid::Document
      include Mongoid::Timestamps

      has_many :entrances, inverse_of: :building, class_name: "TouchableSpec::Referenced::Entrance"
      has_many :floors, inverse_of: :building, class_name: "TouchableSpec::Referenced::Floor"
    end

    class Entrance
      include Mongoid::Document
      include Mongoid::Timestamps

      belongs_to :building, touch: false, class_name: "TouchableSpec::Referenced::Building"
    end

    class Floor
      include Mongoid::Document
      include Mongoid::Timestamps

      field :level, type: Integer

      belongs_to :building, touch: true, class_name: "TouchableSpec::Referenced::Building"
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mongoid-8.1.8 spec/mongoid/touchable_spec_models.rb
mongoid-8.1.7 spec/mongoid/touchable_spec_models.rb
mongoid-8.1.6 spec/mongoid/touchable_spec_models.rb
mongoid-8.1.5 spec/mongoid/touchable_spec_models.rb
mongoid-8.1.4 spec/mongoid/touchable_spec_models.rb
mongoid-8.1.3 spec/mongoid/touchable_spec_models.rb
mongoid-8.1.2 spec/mongoid/touchable_spec_models.rb
mongoid-8.1.1 spec/mongoid/touchable_spec_models.rb
mongoid-8.1.0 spec/mongoid/touchable_spec_models.rb