Guest User

Untitled

a guest
Jul 9th, 2018
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.96 KB | None | 0 0
  1. ## test.rb
  2. user = User.new(:login => "bruce")
  3. user.password = user.password_confirmation = "wayne"
  4. user.save
  5. blog = Blog.new(:author => user, :title => "bruce's blog")
  6. blog.save
  7. 20.times do |i|
  8. blog.posts.create :author => user, :title => "posting #{i}", :content => "content"
  9. end
  10. postings = blog.posts.paginate 3
  11. title = postings[1].title
  12.  
  13. ## log.txt (queries only)
  14. ~ (0.016885) INSERT INTO "users" ("crypted_password", "login", "salt") VALUES ('8dbd1cc548ca0581ec5f5d84bafc884b04ec9a3e', 'bruce', 'a36b69aea7898e3c1f3e613a638c154aeae55a70')
  15. ~ (0.009863) INSERT INTO "blogs" ("title", "user_id") VALUES ('bruce''s blog', 1)
  16. ~ (0.000283) SELECT "id", "title", "updated_at", "created_at", "blog_id", "user_id" FROM "posts" WHERE ("blog_id" IN (1)) ORDER BY "id" DESC
  17. ~ (0.006578) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:28-04:00', 'posting 0', 1, 1, '2009-08-11T08:40:28-04:00', 'content')
  18. ~ (0.008513) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:28-04:00', 'posting 1', 1, 1, '2009-08-11T08:40:28-04:00', 'content')
  19. ~ (0.007068) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:28-04:00', 'posting 2', 1, 1, '2009-08-11T08:40:28-04:00', 'content')
  20. ~ (0.008977) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:28-04:00', 'posting 3', 1, 1, '2009-08-11T08:40:28-04:00', 'content')
  21. ~ (0.007042) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:28-04:00', 'posting 4', 1, 1, '2009-08-11T08:40:28-04:00', 'content')
  22. ~ (0.009184) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:28-04:00', 'posting 5', 1, 1, '2009-08-11T08:40:28-04:00', 'content')
  23. ~ (0.008876) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:28-04:00', 'posting 6', 1, 1, '2009-08-11T08:40:28-04:00', 'content')
  24. ~ (0.011913) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:29-04:00', 'posting 7', 1, 1, '2009-08-11T08:40:29-04:00', 'content')
  25. ~ (0.009535) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:29-04:00', 'posting 8', 1, 1, '2009-08-11T08:40:29-04:00', 'content')
  26. ~ (0.008395) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:29-04:00', 'posting 9', 1, 1, '2009-08-11T08:40:29-04:00', 'content')
  27. ~ (0.009611) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:29-04:00', 'posting 10', 1, 1, '2009-08-11T08:40:29-04:00', 'content')
  28. ~ (0.008224) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:29-04:00', 'posting 11', 1, 1, '2009-08-11T08:40:29-04:00', 'content')
  29. ~ (0.009501) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:29-04:00', 'posting 12', 1, 1, '2009-08-11T08:40:29-04:00', 'content')
  30. ~ (0.008180) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:29-04:00', 'posting 13', 1, 1, '2009-08-11T08:40:29-04:00', 'content')
  31. ~ (0.008648) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:29-04:00', 'posting 14', 1, 1, '2009-08-11T08:40:29-04:00', 'content')
  32. ~ (0.008189) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:29-04:00', 'posting 15', 1, 1, '2009-08-11T08:40:29-04:00', 'content')
  33. ~ (0.007594) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:29-04:00', 'posting 16', 1, 1, '2009-08-11T08:40:29-04:00', 'content')
  34. ~ (0.010952) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:29-04:00', 'posting 17', 1, 1, '2009-08-11T08:40:29-04:00', 'content')
  35. ~ (0.009643) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:29-04:00', 'posting 18', 1, 1, '2009-08-11T08:40:29-04:00', 'content')
  36. ~ (0.007743) INSERT INTO "posts" ("updated_at", "title", "blog_id", "user_id", "created_at", "content") VALUES ('2009-08-11T08:40:29-04:00', 'posting 19', 1, 1, '2009-08-11T08:40:29-04:00', 'content')
  37. ~ (0.000230) SELECT "id", "title", "updated_at", "created_at", "blog_id", "user_id" FROM "posts" WHERE ("blog_id" IN (1)) AND ("id" IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)) ORDER BY "id" DESC LIMIT 1 OFFSET 5
Add Comment
Please, Sign In to add comment