When using ActiveStorage, how do you create a scope for when files are attached.
For example:
class Check < ActiveRecord::Base
has_one_attached :image
end
I want something like Check.has_attached_image to return only records where there is an existing attached image.
I know that ActiveStorage provides a with_attached_image scope. But that doesn't seem to be working:
irb(main):009:0> Check.with_attached_image.to_sql
=> "SELECT \"checks\".* FROM \"checks\""