I am new to Rails and am trying to understand how ActiveStorage works.
The app has the following models:
class Client < ApplicationRecord
has_many :jobs
has_many :messages
end
class Job < ApplicationRecord
belongs_to :client
has_many_attached :images
end
class Message < ApplicationRecord
belongs_to :client
has_many_attached :images
end
In the database I can see the polymorphic relationship and I can also understand what SQL query would get me the desired results.
However I was wondering if there is an idiomatic and efficient way to retrieve all the attachments related to a client?