closure_tree 3.6.1 → 3.6.2

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.
data/README.md CHANGED
@@ -5,9 +5,15 @@ Closure Tree is a mostly-API-compatible replacement for the
5
5
  [acts_as_tree](https://github.com/amerine/acts_as_tree) and
6
6
  [awesome_nested_set](https://github.com/collectiveidea/awesome_nested_set/) gems, giving you:
7
7
 
8
- * Much better mutation performance thanks to the Closure Tree storage algorithm
9
- * Very efficient select performance (again, thanks to Closure Tree)
10
- * Efficient subtree selects
8
+ * Best-in-class select performance:
9
+ * Fetch your whole ancestor lineage in 1 SELECT.
10
+ * Grab all your descendants: 1 SELECT.
11
+ * Get all your siblings: 1 SELECT.
12
+ * Fetch all [7-degrees-of-bacon in a nested hash](#nested-hashes): 1 SELECT.
13
+ * Best-in-class mutation performance:
14
+ * 2 SQL INSERTs on node creation
15
+ * 3 SQL INSERT/UPDATEs on node reparenting
16
+ * Support for reparenting children (and all their progeny)
11
17
  * Support for polymorphism [STI](#sti) within the hierarchy
12
18
  * ```find_or_create_by_path``` for [building out hierarchies quickly and conveniently](#find_or_create_by_path)
13
19
  * Support for [deterministic ordering](#deterministic-ordering) of children
@@ -355,6 +361,11 @@ Closure tree is [tested under every combination](http://travis-ci.org/#!/mceache
355
361
 
356
362
  ## Change log
357
363
 
364
+ ### 3.6.2
365
+
366
+ * Fixed [issue 23](https://github.com/mceachen/closure_tree/issues/23), which added support for ```#siblings```
367
+ when sort_order wasn't specified. Thanks, [garygreyling](https://github.com/garygreyling)!
368
+
358
369
  ### 3.6.1
359
370
 
360
371
  * Fixed [issue 20](https://github.com/mceachen/closure_tree/issues/20), which affected
@@ -182,7 +182,7 @@ module ClosureTree
182
182
 
183
183
  def self_and_siblings
184
184
  s = ct_base_class.where(parent_column_sym => parent)
185
- quoted_order_column ? s.order(quoted_order_column) : s
185
+ order_option.present? ? s.order(quoted_order_column) : s
186
186
  end
187
187
 
188
188
  def siblings
@@ -1,3 +1,3 @@
1
1
  module ClosureTree
2
- VERSION = "3.6.1" unless defined?(::ClosureTree::VERSION)
2
+ VERSION = "3.6.2" unless defined?(::ClosureTree::VERSION)
3
3
  end
data/spec/user_spec.rb CHANGED
@@ -87,7 +87,6 @@ describe "empty db" do
87
87
  u.root.indirect_contracts.to_a.should =~ [c1, c2]
88
88
  end
89
89
 
90
-
91
90
  it "supports << on shallow unsaved hierarchies" do
92
91
  a = User.new(:email => "a")
93
92
  b = User.new(:email => "b")
@@ -116,4 +115,14 @@ describe "empty db" do
116
115
  User.leaves.should =~ [b1, c1, d]
117
116
  d.ancestry_path.should == %w(a b2 c2 d)
118
117
  end
118
+
119
+ it "supports siblings" do
120
+ User.order_option.should be_nil
121
+ a = User.create(:email => "a")
122
+ b1 = a.children.create(:email => "b1")
123
+ b2 = a.children.create(:email => "b2")
124
+ b3 = a.children.create(:email => "b3")
125
+ a.siblings.should be_empty
126
+ b1.siblings.should =~ [b2, b3]
127
+ end
119
128
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: closure_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.1
4
+ version: 3.6.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-17 00:00:00.000000000 Z
12
+ date: 2012-09-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -192,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
192
192
  version: '0'
193
193
  segments:
194
194
  - 0
195
- hash: 4291018222933120120
195
+ hash: -956461018663594337
196
196
  required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  none: false
198
198
  requirements:
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  version: '0'
202
202
  segments:
203
203
  - 0
204
- hash: 4291018222933120120
204
+ hash: -956461018663594337
205
205
  requirements: []
206
206
  rubyforge_project:
207
207
  rubygems_version: 1.8.23