acts_as_better_tree 1.0.0 → 1.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 626f6d72ed65efb1cac94e550e27e3af3cb7206f
4
- data.tar.gz: ea21b886ce356e30985e9702757fb54e557245e5
2
+ SHA256:
3
+ metadata.gz: 6086b1b15a5ae37e65f0214a558f18717e0d56f6f87669ec044334abd2c6f399
4
+ data.tar.gz: 9984975d678640134812db774ae4ed99b94e37ff0653e5ad3f16b66970e4ca49
5
5
  SHA512:
6
- metadata.gz: ca36af0c8a56427ce3d30e4f0d3e6d3c5fef6a011fd3ec31b57a1d42f88b399224c1ef29691e119d642a4033e195aafa12a41312d18ad143d197fc50b5f0e36d
7
- data.tar.gz: ece9981f83c38cf1e6d07a2e1dd2ca00f1717364b89bcc2e002c126536b70baf02212ee78ea8042ad26641b3e31639427b3e6e2bd5350a49d891f861b99dafa4
6
+ metadata.gz: 1095e1017f8b6bd8145e49ebeb71ff1336afaa098e040eb38fd44ded7e245355747d26ef6ac39c8933a12741738a2a3176bd4b82aec3aac6bb3b0f649586c2b3
7
+ data.tar.gz: 8da3c096d3ffd1194cc731fdf9050eb1e8859fbc50005f8ba944ad17d6ebd21cbcf3a525565aceb8a04690f5e7b5f27cfbc1cfc3267058f3f984dd6201f79177
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in acts_as_better_tree.gemspec
4
4
  gemspec
5
- gem 'sqlite3'
6
5
  gem 'rspec'
7
6
  gem 'rails', ">= 3.2.5"
8
- gem "factory_girl"
7
+ gem "factory_girl"
8
+ gem "csv"
data/Gemfile.lock CHANGED
@@ -1,80 +1,180 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- acts_as_better_tree (0.9.4)
4
+ acts_as_better_tree (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actionmailer (3.2.7)
10
- actionpack (= 3.2.7)
11
- mail (~> 2.4.4)
12
- actionpack (3.2.7)
13
- activemodel (= 3.2.7)
14
- activesupport (= 3.2.7)
15
- builder (~> 3.0.0)
16
- erubis (~> 2.7.0)
17
- journey (~> 1.0.4)
18
- rack (~> 1.4.0)
19
- rack-cache (~> 1.2)
20
- rack-test (~> 0.6.1)
21
- sprockets (~> 2.1.3)
22
- activemodel (3.2.7)
23
- activesupport (= 3.2.7)
24
- builder (~> 3.0.0)
25
- activerecord (3.2.7)
26
- activemodel (= 3.2.7)
27
- activesupport (= 3.2.7)
28
- arel (~> 3.0.2)
29
- tzinfo (~> 0.3.29)
30
- activeresource (3.2.7)
31
- activemodel (= 3.2.7)
32
- activesupport (= 3.2.7)
33
- activesupport (3.2.7)
34
- i18n (~> 0.6)
35
- multi_json (~> 1.0)
36
- arel (3.0.2)
37
- builder (3.0.0)
9
+ actioncable (8.0.2)
10
+ actionpack (= 8.0.2)
11
+ activesupport (= 8.0.2)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ zeitwerk (~> 2.6)
15
+ actionmailbox (8.0.2)
16
+ actionpack (= 8.0.2)
17
+ activejob (= 8.0.2)
18
+ activerecord (= 8.0.2)
19
+ activestorage (= 8.0.2)
20
+ activesupport (= 8.0.2)
21
+ mail (>= 2.8.0)
22
+ actionmailer (8.0.2)
23
+ actionpack (= 8.0.2)
24
+ actionview (= 8.0.2)
25
+ activejob (= 8.0.2)
26
+ activesupport (= 8.0.2)
27
+ mail (>= 2.8.0)
28
+ rails-dom-testing (~> 2.2)
29
+ actionpack (8.0.2)
30
+ actionview (= 8.0.2)
31
+ activesupport (= 8.0.2)
32
+ nokogiri (>= 1.8.5)
33
+ rack (>= 2.2.4)
34
+ rack-session (>= 1.0.1)
35
+ rack-test (>= 0.6.3)
36
+ rails-dom-testing (~> 2.2)
37
+ rails-html-sanitizer (~> 1.6)
38
+ useragent (~> 0.16)
39
+ actiontext (8.0.2)
40
+ actionpack (= 8.0.2)
41
+ activerecord (= 8.0.2)
42
+ activestorage (= 8.0.2)
43
+ activesupport (= 8.0.2)
44
+ globalid (>= 0.6.0)
45
+ nokogiri (>= 1.8.5)
46
+ actionview (8.0.2)
47
+ activesupport (= 8.0.2)
48
+ builder (~> 3.1)
49
+ erubi (~> 1.11)
50
+ rails-dom-testing (~> 2.2)
51
+ rails-html-sanitizer (~> 1.6)
52
+ activejob (8.0.2)
53
+ activesupport (= 8.0.2)
54
+ globalid (>= 0.3.6)
55
+ activemodel (8.0.2)
56
+ activesupport (= 8.0.2)
57
+ activerecord (8.0.2)
58
+ activemodel (= 8.0.2)
59
+ activesupport (= 8.0.2)
60
+ timeout (>= 0.4.0)
61
+ activestorage (8.0.2)
62
+ actionpack (= 8.0.2)
63
+ activejob (= 8.0.2)
64
+ activerecord (= 8.0.2)
65
+ activesupport (= 8.0.2)
66
+ marcel (~> 1.0)
67
+ activesupport (8.0.2)
68
+ base64
69
+ benchmark (>= 0.3)
70
+ bigdecimal
71
+ concurrent-ruby (~> 1.0, >= 1.3.1)
72
+ connection_pool (>= 2.2.5)
73
+ drb
74
+ i18n (>= 1.6, < 2)
75
+ logger (>= 1.4.2)
76
+ minitest (>= 5.1)
77
+ securerandom (>= 0.3)
78
+ tzinfo (~> 2.0, >= 2.0.5)
79
+ uri (>= 0.13.1)
80
+ base64 (0.2.0)
81
+ benchmark (0.4.0)
82
+ bigdecimal (3.1.9)
83
+ builder (3.3.0)
84
+ concurrent-ruby (1.3.5)
85
+ connection_pool (2.5.0)
86
+ crass (1.0.6)
87
+ csv (3.3.3)
88
+ date (3.4.1)
38
89
  diff-lcs (1.1.3)
39
- erubis (2.7.0)
90
+ drb (2.2.1)
91
+ erubi (1.13.1)
40
92
  factory_girl (3.6.1)
41
93
  activesupport (>= 3.0.0)
42
- hike (1.2.1)
43
- i18n (0.6.0)
44
- journey (1.0.4)
45
- json (1.7.4)
46
- mail (2.4.4)
47
- i18n (>= 0.4.0)
48
- mime-types (~> 1.16)
49
- treetop (~> 1.4.8)
50
- mime-types (1.19)
51
- multi_json (1.3.6)
52
- polyglot (0.3.3)
53
- rack (1.4.1)
54
- rack-cache (1.2)
55
- rack (>= 0.4)
56
- rack-ssl (1.3.2)
57
- rack
58
- rack-test (0.6.1)
59
- rack (>= 1.0)
60
- rails (3.2.7)
61
- actionmailer (= 3.2.7)
62
- actionpack (= 3.2.7)
63
- activerecord (= 3.2.7)
64
- activeresource (= 3.2.7)
65
- activesupport (= 3.2.7)
66
- bundler (~> 1.0)
67
- railties (= 3.2.7)
68
- railties (3.2.7)
69
- actionpack (= 3.2.7)
70
- activesupport (= 3.2.7)
71
- rack-ssl (~> 1.3.2)
72
- rake (>= 0.8.7)
73
- rdoc (~> 3.4)
74
- thor (>= 0.14.6, < 2.0)
75
- rake (0.9.2.2)
76
- rdoc (3.12)
77
- json (~> 1.4)
94
+ globalid (1.2.1)
95
+ activesupport (>= 6.1)
96
+ i18n (1.14.7)
97
+ concurrent-ruby (~> 1.0)
98
+ io-console (0.8.0)
99
+ irb (1.15.2)
100
+ pp (>= 0.6.0)
101
+ rdoc (>= 4.0.0)
102
+ reline (>= 0.4.2)
103
+ logger (1.7.0)
104
+ loofah (2.24.0)
105
+ crass (~> 1.0.2)
106
+ nokogiri (>= 1.12.0)
107
+ mail (2.8.1)
108
+ mini_mime (>= 0.1.1)
109
+ net-imap
110
+ net-pop
111
+ net-smtp
112
+ marcel (1.0.4)
113
+ mini_mime (1.1.5)
114
+ mini_portile2 (2.8.8)
115
+ minitest (5.25.5)
116
+ net-imap (0.5.6)
117
+ date
118
+ net-protocol
119
+ net-pop (0.1.2)
120
+ net-protocol
121
+ net-protocol (0.2.2)
122
+ timeout
123
+ net-smtp (0.5.1)
124
+ net-protocol
125
+ nio4r (2.7.4)
126
+ nokogiri (1.18.7)
127
+ mini_portile2 (~> 2.8.2)
128
+ racc (~> 1.4)
129
+ pp (0.6.2)
130
+ prettyprint
131
+ prettyprint (0.2.0)
132
+ psych (5.2.3)
133
+ date
134
+ stringio
135
+ racc (1.8.1)
136
+ rack (3.1.12)
137
+ rack-session (2.1.0)
138
+ base64 (>= 0.1.0)
139
+ rack (>= 3.0.0)
140
+ rack-test (2.2.0)
141
+ rack (>= 1.3)
142
+ rackup (2.2.1)
143
+ rack (>= 3)
144
+ rails (8.0.2)
145
+ actioncable (= 8.0.2)
146
+ actionmailbox (= 8.0.2)
147
+ actionmailer (= 8.0.2)
148
+ actionpack (= 8.0.2)
149
+ actiontext (= 8.0.2)
150
+ actionview (= 8.0.2)
151
+ activejob (= 8.0.2)
152
+ activemodel (= 8.0.2)
153
+ activerecord (= 8.0.2)
154
+ activestorage (= 8.0.2)
155
+ activesupport (= 8.0.2)
156
+ bundler (>= 1.15.0)
157
+ railties (= 8.0.2)
158
+ rails-dom-testing (2.2.0)
159
+ activesupport (>= 5.0.0)
160
+ minitest
161
+ nokogiri (>= 1.6)
162
+ rails-html-sanitizer (1.6.2)
163
+ loofah (~> 2.21)
164
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
165
+ railties (8.0.2)
166
+ actionpack (= 8.0.2)
167
+ activesupport (= 8.0.2)
168
+ irb (~> 1.13)
169
+ rackup (>= 1.0.0)
170
+ rake (>= 12.2)
171
+ thor (~> 1.0, >= 1.2.2)
172
+ zeitwerk (~> 2.6)
173
+ rake (13.2.1)
174
+ rdoc (6.13.1)
175
+ psych (>= 4.0.0)
176
+ reline (0.6.1)
177
+ io-console (~> 0.5)
78
178
  rspec (2.11.0)
79
179
  rspec-core (~> 2.11.0)
80
180
  rspec-expectations (~> 2.11.0)
@@ -83,24 +183,29 @@ GEM
83
183
  rspec-expectations (2.11.2)
84
184
  diff-lcs (~> 1.1.3)
85
185
  rspec-mocks (2.11.1)
86
- sprockets (2.1.3)
87
- hike (~> 1.2)
88
- rack (~> 1.0)
89
- tilt (~> 1.1, != 1.3.0)
90
- sqlite3 (1.3.6)
91
- thor (0.15.4)
92
- tilt (1.3.3)
93
- treetop (1.4.10)
94
- polyglot
95
- polyglot (>= 0.3.1)
96
- tzinfo (0.3.33)
186
+ securerandom (0.4.1)
187
+ stringio (3.1.6)
188
+ thor (1.3.2)
189
+ timeout (0.4.3)
190
+ tzinfo (2.0.6)
191
+ concurrent-ruby (~> 1.0)
192
+ uri (1.0.3)
193
+ useragent (0.16.11)
194
+ websocket-driver (0.7.7)
195
+ base64
196
+ websocket-extensions (>= 0.1.0)
197
+ websocket-extensions (0.1.5)
198
+ zeitwerk (2.7.2)
97
199
 
98
200
  PLATFORMS
99
201
  ruby
100
202
 
101
203
  DEPENDENCIES
102
204
  acts_as_better_tree!
205
+ csv
103
206
  factory_girl
104
207
  rails (>= 3.2.5)
105
208
  rspec
106
- sqlite3
209
+
210
+ BUNDLED WITH
211
+ 2.6.5
@@ -1,3 +1,3 @@
1
1
  module ActsAsBetterTree
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -1,5 +1,4 @@
1
1
  require "acts_as_better_tree/version"
2
- require "csv"
3
2
  module ActiveRecord
4
3
  module Acts
5
4
  module BetterTree
@@ -12,10 +11,24 @@ module ActiveRecord
12
11
  configuration = {:order => "id ASC", :destroy_dependent => true }
13
12
  configuration.update(options) if options.is_a?(Hash)
14
13
 
15
- belongs_to :parent, :class_name => name, :foreign_key => :parent_id
16
- has_many :children, -> {order(configuration[:order])}, {:class_name => name, :foreign_key => :parent_id}.merge(configuration[:destroy_dependent] ? {:dependent => :destroy} : {})
17
- has_many :parents_children, -> {order(configuration[:order])}, {:class_name => name, :primary_key => :parent_id, :foreign_key => :parent_id}
18
- belongs_to :root, :class_name => name, :foreign_key => :root_id
14
+ belongs_to :parent,
15
+ class_name: name,
16
+ foreign_key: :parent_id
17
+ has_many :children,
18
+ -> { order(configuration[:order]) },
19
+ class_name: name,
20
+ foreign_key: :parent_id,
21
+ dependent: configuration[:destroy_dependent] ? :destroy : nil
22
+ has_many :parents_children,
23
+ -> { order(configuration[:order]) },
24
+ class_name: name,
25
+ primary_key: :parent_id,
26
+ foreign_key: :parent_id
27
+ belongs_to :root,
28
+ class_name: name,
29
+ foreign_key: :root_id,
30
+ optional: true,
31
+ dependent: :destroy
19
32
  scope :roots, -> {order(configuration[:order]).where(:parent_id => nil)}
20
33
  after_create :assign_csv_ids
21
34
  after_validation :update_csv_ids, :on => :update
@@ -116,11 +129,11 @@ module ActiveRecord
116
129
  end
117
130
 
118
131
  def move_to_child_of(category)
119
- self.update_attributes(:parent_id => category.id)
132
+ self.update(parent_id: category.id)
120
133
  end
121
134
 
122
135
  def make_root
123
- self.update_attributes(:parent_id => nil)
136
+ self.update(parent_id: nil)
124
137
  end
125
138
 
126
139
  def to_csv(nodes = self.children)
@@ -157,7 +170,7 @@ module ActiveRecord
157
170
  end
158
171
 
159
172
  def assign_csv_ids
160
- self.update_attributes(:csv_ids => build_csv_ids, :root_id => build_root_id)
173
+ self.update(csv_ids: build_csv_ids, root_id: build_root_id)
161
174
  end
162
175
 
163
176
  def update_csv_ids
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_better_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Isaac Sloan
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2016-04-22 00:00:00.000000000 Z
10
+ date: 2025-04-17 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: acts_as_better_tree is great for anyone who needs a fast tree capable
14
13
  of handling millions of nodes without slowing down on writes like nestedset or on
@@ -34,7 +33,6 @@ files:
34
33
  homepage: https://github.com/isaacsloan/acts_as_better_tree
35
34
  licenses: []
36
35
  metadata: {}
37
- post_install_message:
38
36
  rdoc_options: []
39
37
  require_paths:
40
38
  - lib
@@ -49,9 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
47
  - !ruby/object:Gem::Version
50
48
  version: '0'
51
49
  requirements: []
52
- rubyforge_project:
53
- rubygems_version: 2.4.5.1
54
- signing_key:
50
+ rubygems_version: 3.6.2
55
51
  specification_version: 4
56
52
  summary: acts_as_better_tree is backwards compatible with acts_as_tree and remains
57
53
  fast with large datasets by storing the ancestry of every node in the field csv_ids.