Skip to content

Instantly share code, notes, and snippets.

@rafaelss
Created February 11, 2010 12:48
Show Gist options
  • Save rafaelss/301472 to your computer and use it in GitHub Desktop.
Save rafaelss/301472 to your computer and use it in GitHub Desktop.
# isso não devia ser assim
ActiveRecord::Base.connection.select_all("select count(*) as count from ...;")[0]['count'].to_i
# e sim, assim :)
ActiveRecord::Base.connection.select_value("select count(*) as count from ...").to_i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment