Sha256: 105e2311f1427dc4afe2785fc6eae8feb6c9276dca925f168753fb2798c1cb23
Contents?: true
Size: 899 Bytes
Versions: 1
Compression:
Stored size: 899 Bytes
Contents
# frozen_string_literal: true module G5Updatable class HubAmenity < ActiveRecord::Base validates :external_id, presence: true has_many :hub_amenities_locations, foreign_key: :g5_updatable_hub_amenity_id scope :by_client_urn, lambda { |client_urn| joins(hub_amenities_locations: { location: :client }) .where('g5_updatable_clients.urn = :client_urn', client_urn: client_urn).distinct } scope :by_client_urns, lambda { |client_urns| joins(hub_amenities_locations: { location: :client }) .where('g5_updatable_clients.urn IN (:client_urns)', client_urns: client_urns.join(',')).distinct } scope :by_client_uid, lambda { |client_uid| joins(hub_amenities_locations: :location) .where('g5_updatable_locations.client_uid = :client_uid', client_uid: client_uid).distinct } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
g5_updatable-1.0.2.pre.1 | app/models/g5_updatable/hub_amenity.rb |