acts_as_tree 2.6.1 → 2.7.0

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: 12616559e89eeee23f6e37d97779cc5e1f3c50de
4
- data.tar.gz: 32344222affc6cd7746e14fe4a0d218e0fca5e35
3
+ metadata.gz: 75417b3f6a18bdc37755a52d6864b30fd7dd1222
4
+ data.tar.gz: 3cb4d2e1bc5a105fa0be41136f715c88e59d19a1
5
5
  SHA512:
6
- metadata.gz: 484644c639c9dceda0c847ac3e57e861ed3429316116ae5d1f34547f8109a0d99811a3a98a205a5e7b6bc50b25348104bb8e03da1043d8b4cc0e8f34d870408f
7
- data.tar.gz: 75cf6219da3b6d5a87c46246b16431d81dd5966df06e82d23996e474078afa1d734ab02e0a1afbd544393421ee0f305beff914b29e76cfbe551b3f25438892b3
6
+ metadata.gz: 4412b677467ff33f58855d1b498dfc6852f08c1e024af9f0669c23741b2acb2787f966e793ec5774613449922795f3d80c30aff119cbd0692c8779769e94faff
7
+ data.tar.gz: 0f229e16aed8c8844292e7cb9f2ea9707fb615c7afd5cab06622cda82543c90beecfe34499cdd1993972c4ca9911dd6855a91b9b48702bcf35b31bd55ca09038
@@ -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
@@ -1,5 +1,5 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "rails", "~> 5.0.0.beta1"
3
+ gem "rails", "~> 5.0.0"
4
4
 
5
5
  gemspec path: "../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~> 5.1.0"
4
+
5
+ gemspec path: "../"
@@ -145,7 +145,7 @@ module ActsAsTree
145
145
  end
146
146
 
147
147
  else
148
- # Fallback to less efficent ways to find leaves.
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
- def update_parents_counter_cache
359
- counter_cache_column = self.class.children_counter_cache_column
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
- if parent_id_changed?
362
- self.class.decrement_counter(counter_cache_column, parent_id_was)
363
- self.class.increment_counter(counter_cache_column, parent_id)
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
@@ -1,3 +1,3 @@
1
1
  module ActsAsTree
2
- VERSION = "2.6.1"
2
+ VERSION = "2.7.0"
3
3
  end
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.6.1
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-01-18 00:00:00.000000000 Z
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.5.1
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.