Created
April 14, 2011 03:27
-
-
Save fedesoria/918844 to your computer and use it in GitHub Desktop.
Paperclip Scopes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For finding images as in Article.attachments.images | |
scope :images, where("file_content_type LIKE ?", "image%") | |
# For finding other files Article.attachments.docs | |
scope :docs, where("file_content_type NOT LIKE ?", "image%") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment