Skip to content

Instantly share code, notes, and snippets.

@jameswritescode
Created August 22, 2014 00:39
Show Gist options
  • Select an option

  • Save jameswritescode/ee4313c9c5ccfd28a421 to your computer and use it in GitHub Desktop.

Select an option

Save jameswritescode/ee4313c9c5ccfd28a421 to your computer and use it in GitHub Desktop.
42: def user_has_username?(nick)
43: result = database.execute("SELECT username FROM lastfm WHERE nick = ? LIMIT 1", [nick])
44:
=> 45: binding.pry
46:
47: result.first[0] unless result.count.zero?
48: end
[1] pry(Howell)> nick
=> "newton"
[2] pry(Howell)> result
=> []
[3] pry(Howell)> database.execute("SELECT username FROM lastfm WHERE nick = ? LIMIT 1", ['newton'])
=> [["sindacious"]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment