Skip to content

Instantly share code, notes, and snippets.

@rajputvai
Last active December 30, 2015 21:39
Show Gist options
  • Save rajputvai/7889092 to your computer and use it in GitHub Desktop.
Save rajputvai/7889092 to your computer and use it in GitHub Desktop.
users = User.where('name IS NULL')
users.each do |user|
# Some api call which will retrive name of the user based on user email
name = API.getUserName user.email
if name.blank?
next
else
user.update_attribute(:name, name)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment