From 5d3ecb2f1607bbe17d80a5a4147d4f601de52b5c Mon Sep 17 00:00:00 2001 From: Benjamin Fleischer Date: Thu, 12 Oct 2017 23:37:34 -0500 Subject: [PATCH] Consistent records --- benchmarks/serialization_libraries/support/bench_helper.rb | 7 ++++--- benchmarks/serialization_libraries/support/rails.rb | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/benchmarks/serialization_libraries/support/bench_helper.rb b/benchmarks/serialization_libraries/support/bench_helper.rb index 9ad2ab8c..0b37cccc 100644 --- a/benchmarks/serialization_libraries/support/bench_helper.rb +++ b/benchmarks/serialization_libraries/support/bench_helper.rb @@ -13,12 +13,13 @@ module BenchHelper posts: 20 } - u = User.create(first_name: 'Diana', last_name: 'Prince', birthday: 3000.years.ago) + anchor_time = Time.new(2017,7,1).utc + user = User.create(first_name: 'Diana', last_name: 'Prince', birthday: anchor_time, created_at: anchor_time, updated_at: anchor_time) data_config[:posts].times do - p = Post.create(user_id: u.id, title: 'Some Post', body: 'awesome content') + post = Post.create(user_id: user.id, title: 'Some Post', body: 'awesome content', created_at: anchor_time, updated_at: anchor_time) data_config[:comments_per_post].times do - Comment.create(author: 'me', comment: 'nice blog', post_id: p.id) + Comment.create(author: 'me', comment: 'nice blog', post_id: post.id, created_at: anchor_time, updated_at: anchor_time) end end end diff --git a/benchmarks/serialization_libraries/support/rails.rb b/benchmarks/serialization_libraries/support/rails.rb index 94ef7cda..eef52abb 100644 --- a/benchmarks/serialization_libraries/support/rails.rb +++ b/benchmarks/serialization_libraries/support/rails.rb @@ -36,14 +36,17 @@ class ApplicationRecord < ActiveRecord::Base end class Comment < ApplicationRecord + default_scope { order(:id) } belongs_to :post end class Post < ApplicationRecord + default_scope { order(:id) } has_many :comments belongs_to :user end class User < ApplicationRecord + default_scope { order(:id) } has_many :posts end