Skip to content

Instantly share code, notes, and snippets.

@mizoR
Created October 10, 2012 02:53
Show Gist options
  • Save mizoR/3862879 to your computer and use it in GitHub Desktop.
Save mizoR/3862879 to your computer and use it in GitHub Desktop.
*_before_type_cast (sqlite database)
irb(main):001:0> user = User.last
User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
=> #<User id: 2, email: "test@example.com", crypted_password: "$2a$10$zP5NtJOkczDUJmqwpaBK6u1dsKLReTcRW7TA5QubCn.m...", salt: "AJ7sa5TqToMfZxnkxPMn", created_at: "2012-10-01 05:20:41", updated_at: "2012-10-01 05:20:41", remember_me_token: nil, remember_me_token_expires_at: nil, reset_password_token: nil, reset_password_token_expires_at: nil, reset_password_email_sent_at: nil>
irb(main):002:0> user.created_at
=> Mon, 01 Oct 2012 05:20:41 UTC +00:00
irb(main):003:0> user.created_at.class
=> ActiveSupport::TimeWithZone
irb(main):004:0> user.created_at_before_type_cast
=> "2012-10-01 05:20:41.811503"
irb(main):005:0> user.created_at_before_type_cast.class
=> String
@morygonzalez
Copy link

おー

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment