Sha256: 7ea7e0b4a5875dd06fffaac7ed8c17bc2953f6c48bc6d1e16ff75cf153ced2a4

Contents?: true

Size: 1.44 KB

Versions: 8

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

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

      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, 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

8 entries across 8 versions & 1 rubygems

Version Path
mongoid-8.0.8 spec/mongoid/touchable_spec_models.rb
mongoid-8.0.7 spec/mongoid/touchable_spec_models.rb
mongoid-8.0.6 spec/mongoid/touchable_spec_models.rb
mongoid-8.0.5 spec/mongoid/touchable_spec_models.rb
mongoid-8.0.4 spec/mongoid/touchable_spec_models.rb
mongoid-8.0.3 spec/mongoid/touchable_spec_models.rb
mongoid-8.0.2 spec/mongoid/touchable_spec_models.rb
mongoid-8.0.1 spec/mongoid/touchable_spec_models.rb