acts_as_list 0.9.7 → 0.9.8

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: 5b35b94ee2481d5aa7769ad28c831a22b32f52f1
4
- data.tar.gz: 4225a9120de7b64301c02253360ea83c0c708e95
3
+ metadata.gz: 864fb6e920d9bb5ca2b305e4e76b95519b900ecc
4
+ data.tar.gz: 5ee3657665bae3f1da65b9d91d43a2764b05f6eb
5
5
  SHA512:
6
- metadata.gz: 71ebdaf48b8d0074786a683e0022864c6750231f27b113d81830d3c902075fa4615c0c246d179657167817c82a9da4de062070b5b525a7c51eca3ba46b7db74f
7
- data.tar.gz: ac65c86c906b4001a44641fc78806445598ab76386bcc0ee89469633b9f2fc8fb2a964eb1b7e7828fb1a5834f2b965ceaed08b9ef579757523b2f93b1943388e
6
+ metadata.gz: af1bf25445a284d3911f876a8c3fe45c083c1af5cec67f141e72ba1e6035f17011cac9157f74f4e712ff366641d97e0634ef85297771cc868e051d0297e6008d
7
+ data.tar.gz: 623352d9b387dbe134c14ffe301eac69744e5eb63f49108da683e924f90ea16151015ab6faf296f93e5513eaf7872332a9746cabaf9d459ab2e1dafa83c4d2ba
@@ -1,5 +1,8 @@
1
1
  # Change Log
2
2
 
3
+ ## [v0.9.7](https://github.com/swanandp/acts_as_list/tree/v0.9.7) (2017-07-06)
4
+ [Full Changelog](https://github.com/swanandp/acts_as_list/compare/v0.9.6...v0.9.7)
5
+
3
6
  ## [v0.9.6](https://github.com/swanandp/acts_as_list/tree/v0.9.6) (2017-07-05)
4
7
  [Full Changelog](https://github.com/swanandp/acts_as_list/compare/v0.9.5...v0.9.6)
5
8
 
@@ -399,6 +399,8 @@ module ActiveRecord
399
399
  end
400
400
 
401
401
  def update_positions
402
+ return unless position_before_save_changed?
403
+
402
404
  old_position = position_before_save || bottom_position_in_list + 1
403
405
  new_position = send(position_column).to_i
404
406
 
@@ -408,13 +410,23 @@ module ActiveRecord
408
410
  shuffle_positions_on_intermediate_items old_position, new_position, id
409
411
  end
410
412
 
413
+ def position_before_save_changed?
414
+ if ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR >= 1 ||
415
+ ActiveRecord::VERSION::MAJOR > 5
416
+
417
+ saved_change_to_attribute? position_column
418
+ else
419
+ send "#{position_column}_changed?"
420
+ end
421
+ end
422
+
411
423
  def position_before_save
412
424
  if ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR >= 1 ||
413
425
  ActiveRecord::VERSION::MAJOR > 5
414
426
 
415
- send("#{position_column}_before_last_save")
427
+ attribute_before_last_save position_column
416
428
  else
417
- send("#{position_column}_was")
429
+ send "#{position_column}_was"
418
430
  end
419
431
  end
420
432
 
@@ -1,7 +1,7 @@
1
1
  module ActiveRecord
2
2
  module Acts
3
3
  module List
4
- VERSION = '0.9.7'
4
+ VERSION = '0.9.8'
5
5
  end
6
6
  end
7
7
  end
@@ -718,7 +718,7 @@ class TouchTest < ActsAsListTestCase
718
718
  end
719
719
 
720
720
  def now
721
- @now ||= Time.current
721
+ @now ||= Time.current.change(usec: 0)
722
722
  end
723
723
 
724
724
  def yesterday
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-07-06 00:00:00.000000000 Z
13
+ date: 2017-09-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord