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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/acts_as_list/active_record/acts/list.rb +14 -2
- data/lib/acts_as_list/version.rb +1 -1
- data/test/test_list.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 864fb6e920d9bb5ca2b305e4e76b95519b900ecc
|
4
|
+
data.tar.gz: 5ee3657665bae3f1da65b9d91d43a2764b05f6eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af1bf25445a284d3911f876a8c3fe45c083c1af5cec67f141e72ba1e6035f17011cac9157f74f4e712ff366641d97e0634ef85297771cc868e051d0297e6008d
|
7
|
+
data.tar.gz: 623352d9b387dbe134c14ffe301eac69744e5eb63f49108da683e924f90ea16151015ab6faf296f93e5513eaf7872332a9746cabaf9d459ab2e1dafa83c4d2ba
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
427
|
+
attribute_before_last_save position_column
|
416
428
|
else
|
417
|
-
send
|
429
|
+
send "#{position_column}_was"
|
418
430
|
end
|
419
431
|
end
|
420
432
|
|
data/lib/acts_as_list/version.rb
CHANGED
data/test/test_list.rb
CHANGED
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.
|
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-
|
13
|
+
date: 2017-09-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|