acts_as_tree 2.6.1 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +12 -0
- data/README.md +2 -0
- data/gemfiles/rails-5.0.gemfile +1 -1
- data/gemfiles/rails-5.1.gemfile +5 -0
- data/lib/acts_as_tree.rb +17 -6
- data/lib/acts_as_tree/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75417b3f6a18bdc37755a52d6864b30fd7dd1222
|
4
|
+
data.tar.gz: 3cb4d2e1bc5a105fa0be41136f715c88e59d19a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4412b677467ff33f58855d1b498dfc6852f08c1e024af9f0669c23741b2acb2787f966e793ec5774613449922795f3d80c30aff119cbd0692c8779769e94faff
|
7
|
+
data.tar.gz: 0f229e16aed8c8844292e7cb9f2ea9707fb615c7afd5cab06622cda82543c90beecfe34499cdd1993972c4ca9911dd6855a91b9b48702bcf35b31bd55ca09038
|
data/.travis.yml
CHANGED
@@ -3,6 +3,8 @@ language: ruby
|
|
3
3
|
sudo: false
|
4
4
|
cache: bundler
|
5
5
|
|
6
|
+
before_install: gem install bundler -v '~> 1.15' --conservative --minimal-deps
|
7
|
+
|
6
8
|
rvm:
|
7
9
|
- 1.9.2
|
8
10
|
- 1.9.3
|
@@ -18,6 +20,7 @@ gemfile:
|
|
18
20
|
- gemfiles/rails-4.1.gemfile
|
19
21
|
- gemfiles/rails-4.2.gemfile
|
20
22
|
- gemfiles/rails-5.0.gemfile
|
23
|
+
- gemfiles/rails-5.1.gemfile
|
21
24
|
|
22
25
|
matrix:
|
23
26
|
exclude:
|
@@ -50,3 +53,12 @@ matrix:
|
|
50
53
|
gemfile: gemfiles/rails-5.0.gemfile
|
51
54
|
- rvm: 2.1.8
|
52
55
|
gemfile: gemfiles/rails-5.0.gemfile
|
56
|
+
# rails 5.1 requires ruby 2.2.2+
|
57
|
+
- rvm: 1.9.2
|
58
|
+
gemfile: gemfiles/rails-5.1.gemfile
|
59
|
+
- rvm: 1.9.3
|
60
|
+
gemfile: gemfiles/rails-5.1.gemfile
|
61
|
+
- rvm: 2.0.0
|
62
|
+
gemfile: gemfiles/rails-5.1.gemfile
|
63
|
+
- rvm: 2.1.8
|
64
|
+
gemfile: gemfiles/rails-5.1.gemfile
|
data/README.md
CHANGED
@@ -74,6 +74,8 @@ We no longer support Ruby 1.8 or versions of Rails/ActiveRecord older than 3.0.
|
|
74
74
|
Moving forward we will do our best to support the latest versions of ActiveRecord and Ruby.
|
75
75
|
|
76
76
|
## Change Log
|
77
|
+
* 2.7.0 - September 15, 2017
|
78
|
+
* Added support for rails 5.1, see #67, #68 -- felixbuenemann, marcinwierzbicki
|
77
79
|
* 2.6.1 - January 18, 2017
|
78
80
|
* Avoid conflicts of `#level` method with existing column, see #57, #58, #60 -- markhgbrewster
|
79
81
|
* Fix tests on rails 4.2 with ruby < 2.1 -- felixbuenemann
|
data/gemfiles/rails-5.0.gemfile
CHANGED
data/lib/acts_as_tree.rb
CHANGED
@@ -145,7 +145,7 @@ module ActsAsTree
|
|
145
145
|
end
|
146
146
|
|
147
147
|
else
|
148
|
-
# Fallback to less
|
148
|
+
# Fallback to less efficient ways to find leaves.
|
149
149
|
class_eval <<-EOV
|
150
150
|
def self.leaves
|
151
151
|
internal_ids = select(:#{configuration[:foreign_key]}).where(arel_table[:#{configuration[:foreign_key]}].not_eq(nil))
|
@@ -355,12 +355,23 @@ module ActsAsTree
|
|
355
355
|
|
356
356
|
private
|
357
357
|
|
358
|
-
|
359
|
-
|
358
|
+
if ActiveRecord::VERSION::MAJOR > 5 || ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR >= 1
|
359
|
+
def update_parents_counter_cache
|
360
|
+
counter_cache_column = self.class.children_counter_cache_column
|
360
361
|
|
361
|
-
|
362
|
-
|
363
|
-
|
362
|
+
if saved_change_to_parent_id?
|
363
|
+
self.class.decrement_counter(counter_cache_column, parent_id_before_last_save)
|
364
|
+
self.class.increment_counter(counter_cache_column, parent_id)
|
365
|
+
end
|
366
|
+
end
|
367
|
+
else
|
368
|
+
def update_parents_counter_cache
|
369
|
+
counter_cache_column = self.class.children_counter_cache_column
|
370
|
+
|
371
|
+
if parent_id_changed?
|
372
|
+
self.class.decrement_counter(counter_cache_column, parent_id_was)
|
373
|
+
self.class.increment_counter(counter_cache_column, parent_id)
|
374
|
+
end
|
364
375
|
end
|
365
376
|
end
|
366
377
|
end
|
data/lib/acts_as_tree/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Dahlstrand
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2017-
|
15
|
+
date: 2017-09-14 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activerecord
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- gemfiles/rails-4.1.gemfile
|
95
95
|
- gemfiles/rails-4.2.gemfile
|
96
96
|
- gemfiles/rails-5.0.gemfile
|
97
|
+
- gemfiles/rails-5.1.gemfile
|
97
98
|
- lib/acts_as_tree.rb
|
98
99
|
- lib/acts_as_tree/active_record/acts/tree.rb
|
99
100
|
- lib/acts_as_tree/railtie.rb
|
@@ -119,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
120
|
version: '0'
|
120
121
|
requirements: []
|
121
122
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
123
|
+
rubygems_version: 2.6.13
|
123
124
|
signing_key:
|
124
125
|
specification_version: 4
|
125
126
|
summary: Provides a simple tree behaviour to active_record models.
|