Class: ReviewsIoImage

Inherits:
ApplicationRecord show all
Defined in:
app/models/reviews_io_image.rb

Overview

Join model linking ReviewsIo records to imported Image records.
Tracks which external photo URL was imported, enabling idempotent re-imports.
== Schema Information

Table name: reviews_io_images
Database name: primary

id :bigint not null, primary key
source_url :string not null
created_at :datetime not null
updated_at :datetime not null
image_id :bigint not null
reviews_io_id :bigint not null

Indexes

index_reviews_io_images_on_image_id (image_id)
index_reviews_io_images_on_reviews_io_id_and_image_id (reviews_io_id,image_id) UNIQUE
index_reviews_io_images_on_source_url (source_url)

Foreign Keys

fk_rails_... (image_id => digital_assets.id)
fk_rails_... (reviews_io_id => reviews_io.id)

Instance Attribute Summary collapse

Belongs to collapse

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Models::EventPublishable

#publish_event

Instance Attribute Details

#image_idObject (readonly)



33
# File 'app/models/reviews_io_image.rb', line 33

validates :image_id, uniqueness: { scope: :reviews_io_id }

#source_urlObject (readonly)



32
# File 'app/models/reviews_io_image.rb', line 32

validates :source_url, presence: true

Instance Method Details

#imageImage

Returns:

See Also:



30
# File 'app/models/reviews_io_image.rb', line 30

belongs_to :image

#reviews_ioReviewsIo

Returns:

See Also:



29
# File 'app/models/reviews_io_image.rb', line 29

belongs_to :reviews_io