snapshotable 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97edd33c2a2d4eb2935bd9549d402d18e8a7e0b5
4
- data.tar.gz: 9f2422fd653a7bda5836f1048f7e0816bfd142c9
3
+ metadata.gz: 97736b89ca3b9265b16370886688ddbf7b038abe
4
+ data.tar.gz: b4972e8982f4106a56a794ee48d585d734a01bad
5
5
  SHA512:
6
- metadata.gz: 81abb9b0399c32faa5396afc2a7bf7438cac10a731b607d226fe595b3c13ddf2b5d43c56ffd5e3680e2d200567cddb56c2854e6f3142a0ace26b8b11a913b1ec
7
- data.tar.gz: 88443b76a5c4916ed257bc65f1397d9a0c8f2161fd5305e024ada7056896baf9a8953f995adcec1ddf9ce6ebb60d49efebea8aae24d6a779f09ffac3d4769974
6
+ metadata.gz: b5d42ac01b258823140ac633a1b7f066dc615a1621f78507e2a5239c88c73de70802f58d3b452f6c362076bf762dc34f17d9e96c7ea95f6a47ccd59132b80a50
7
+ data.tar.gz: d449313742bd3a8687f0ddb8b8878f76ecbcc352a9b462dbf716a4b784885306ef9d0869e6d354d1d7c7d2e7f7c69417c3b1df261e08f869abe8db7db1860679
@@ -25,7 +25,7 @@ module Snapshotable
25
25
  def self.next_migration_number(dirname) #:nodoc:
26
26
  next_migration_number = current_migration_number(dirname) + 1
27
27
  if ActiveRecord::Base.timestamped_migrations
28
- [Time.now.utc.strftime('%Y%m%d%H%M%S'), format('%.14d', next_migration_number)].max
28
+ [Time.zone.now.utc.strftime('%Y%m%d%H%M%S'), format('%.14d', next_migration_number)].max
29
29
  else
30
30
  format('%.3d', next_migration_number)
31
31
  end
@@ -44,7 +44,7 @@ module Snapshotable
44
44
  association = record.send(association_name)
45
45
 
46
46
  snapshot["#{association_name}_object"] = if association.class.name == 'ActiveRecord::Associations::CollectionProxy'
47
- association.map { |model| extract_attributes(attributes, model) }
47
+ association.order(:id).map { |model| extract_attributes(attributes, model) }
48
48
  else
49
49
  extract_attributes(attributes, association)
50
50
  end
@@ -38,7 +38,7 @@ module Snapshotable
38
38
  send(snapshot_association_name)
39
39
  end
40
40
 
41
- def last_snapshot_before(time = Time.now)
41
+ def last_snapshot_before(time = Time.zone.now)
42
42
  snapshots.order(created_at: :desc).where('created_at < ?', time).first
43
43
  end
44
44
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Snapshotable
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.4'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snapshotable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - João Batista Marinho
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-08-14 00:00:00.000000000 Z
12
+ date: 2018-08-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord