Skip to content

Instantly share code, notes, and snippets.

@1dolinski
Last active December 19, 2015 04:28
Show Gist options
  • Save 1dolinski/5897130 to your computer and use it in GitHub Desktop.
Save 1dolinski/5897130 to your computer and use it in GitHub Desktop.
[17] pry(main)> ids = User.all.map(&:id)
=> [2, 1, 3, 4, 5]
[19] pry(main)> ids.each do |id|
[19] pry(main)* @users = User.where(id: id) rescue User.where(id: id)
[19] pry(main)* end
=> [2, 1, 3, 4, 5]
Why doesn't this return all of the instances of User?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment