Question: How to select all records having an attachment?

Question

How to select all records having an attachment?

Answers 1
Added at 2016-12-16 15:12
Tags
Question

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?

Answers
nr: #1 dodano: 2016-12-16 16:12

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

Source Show
◀ Wstecz