Skip to content

Instantly share code, notes, and snippets.

@MTen
MTen / gist:6893541
Created October 8, 2013 23:24 — forked from jleo3/gist:6893539
[1] pry(main)> Book
=> Book(id: integer, title: string, author: string, abstract: text, created_at: datetime, updated_at: datetime)
[2] pry(main)> Book.create title: "Who Stole My Cheese?"
(0.1ms) begin transaction
SQL (5.1ms) INSERT INTO "books" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 08 Oct 2013 23:14:31 UTC +00:00], ["title", "Who Stole My Cheese?"], ["updated_at", Tue, 08 Oct 2013 23:14:31 UTC +00:00]]
(14.9ms) commit transaction
=> #<Book id: 4, title: "Who Stole My Cheese?", author: nil, abstract: nil, created_at: "2013-10-08 23:14:31", updated_at: "2013-10-08 23:14:31">
[3] pry(main)> Book.find(4)
Book Load (0.3ms) SELECT "books".* FROM "books" WHERE "books"."id" = ? LIMIT 1 [["id", 4]]
=> #<Book id: 4, title: "Who Stole My Cheese?", author: nil, abstract: nil, created_at: "2013-10-08 23:14:31", updated_at: "2013-10-08 23:14:31">