Skip to content

Instantly share code, notes, and snippets.

@francirp
Created July 10, 2014 14:32
Show Gist options
  • Save francirp/87a005dfedd784b721e5 to your computer and use it in GitHub Desktop.
Save francirp/87a005dfedd784b721e5 to your computer and use it in GitHub Desktop.
Manipulating an Array with find_all
all_pictures = Picture.all
pictures_with_source = all_pictures.find_all do |picture|
picture.source.present?
end
# pictures_with_source should now contain all of the pictures where the source is not empty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment