Skip to content

Instantly share code, notes, and snippets.

@zhhz
Created March 20, 2009 16:32
Embed
What would you like to do?
# DM 0.9.9
users = User.all
names = users.collect{|u| u.first_name}
names.uniq # works well, return all the names
names.uniq! # diff from MRI: return nil
# MRI
a = [1, 2, 3, 1, 2]
a.uniq #[3]
puts a #[1, 2, 3, 1, 2]
a.uniq! #[3] # diff from the DM
puts a # [3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment