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)

Constant Summary

Constants included from Models::Schedulable

Models::Schedulable::SIMPLE_FORM_OPTIONS

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::Schedulable

config

Methods included from Models::AfterCommittable

#after_commit

Methods included from Models::EventPublishable

#publish_event

Instance Attribute Details

#image_idInteger

Returns Foreign key to the imported image asset.

Returns:

  • (Integer)

    Foreign key to the imported image asset.



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

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

#source_urlString

Returns External image URL.

Returns:

  • (String)

    External image URL.



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

validates :source_url, presence: true

Instance Method Details

#imageDigitalAsset

Returns:



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

belongs_to :image

#reviews_ioReviewsIo

Returns:



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

belongs_to :reviews_io