Skip to content

Instantly share code, notes, and snippets.

@metaskills
Created September 2, 2010 15:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metaskills/562465 to your computer and use it in GitHub Desktop.
Save metaskills/562465 to your computer and use it in GitHub Desktop.
Topic.columns_hash['written_on'].sql_type # => "datetime"
Topic.columns_hash['bonus_time'].sql_type # => "time"
Topic.columns_hash['last_read'].sql_type # => "date"
Topic.count # => 4
data = Topic.connection.send(:select,"SELECT `topics`.* FROM `topics`")
row = data[0]
row['written_on'] # => 2003-07-16 10:28:11 UTC
row['written_on'].class # => Time
row['bonus_time'] # => 2000-01-01 09:28:00 UTC
row['bonus_time'].class # => Time
row['last_read'] # => Thu, 15 Apr 2004
row['last_read'].class # => Date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment