Skip to content

Instantly share code, notes, and snippets.

@oliverbarnes
Created May 31, 2011 16:56
Show Gist options
  • Select an option

  • Save oliverbarnes/1000874 to your computer and use it in GitHub Desktop.

Select an option

Save oliverbarnes/1000874 to your computer and use it in GitHub Desktop.
remove spaces from usernames
Profile.all({:username => /\s/}).each do |p|
old_username = p.username
p.set(:username => p.username.gsub(/\s+/, ""))
p.reload
msg = "Notify: #{p.full_name} <#{p.email}>"
msg << " - Old username: \"#{old_username}\""
msg << " => New username: \"#{p.username}\""
puts msg
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment