You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Assuming a model defined like so:classPost < ApplicationRecordhas_one_attached:imageend# ...you can join against :image_attachment to select posts having attached images:Post.joins(:image_attachment).where('published_at >= ?',Time.now)
In the future, please ask usage questions on the rubyonrails-talk mailing list or on Stack Overflow. We reserve the issue tracker for bugs.
In case anyone is looking for a way to join against the active_storage_blobs table, this can be achieved by with the *_blob (like image_blob) association.
Here's an example that sum how many bytes are used by the attachments:
Is there a way via a scope to only select all records with an attachment?
System configuration
Rails version: 5.2.0.rc1
Ruby version: 2.5
The text was updated successfully, but these errors were encountered: