Antronin
Antronin

Reputation: 57

How to select all records having an attachment?

I'm using rails4 with paperclip. On one of my forms I would like to list only the records of a resource having a paperclips attachment. Is there any built in support for this in paperclip?

Upvotes: 0

Views: 111

Answers (1)

Mafi
Mafi

Reputation: 196

Try using YourModel.where.not(attachment_file_name: nil)

Upvotes: 2

Related Questions