awesome_nested_set 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,18 @@
1
+ 2.1.1
2
+ * Added 'depth' which indicates how many levels deep the node is.
3
+ This only works when you have a column called 'depth' in your table,
4
+ otherwise it doesn't set itself. [Philip Arndt]
5
+ * Rails 3.2 support added. [Gabriel Sobrinho]
6
+ * Oracle compatibility added. [Pikender Sharma]
7
+ * Adding row locking to deletion, locking source of pivot values, and adding retry on collisions. [Markus J. Q. Roberts]
8
+ * Added method and helper for sorting children by column. [bluegod]
9
+ * Fixed .all_roots_valid? to work with Postgres. [Joshua Clayton]
10
+ * Made compatible with polymorphic belongs_to. [Graham Randall]
11
+ * Added in the association callbacks to the children :has_many association. [Michael Deering]
12
+ * Modified helper to allow using array of objects as argument. [Rahmat Budiharso]
13
+ * Fixed cases where we were calling attr_protected. [Jacob Swanner]
14
+ * Fixed nil cases involving lft and rgt. [Stuart Coyle] and [Patrick Morgan]
15
+
1
16
  2.0.2
2
17
  * Fixed deprecation warning under Rails 3.1 [Philip Arndt]
3
18
  * Converted Test::Unit matchers to RSpec. [Uģis Ozols]
@@ -16,7 +16,8 @@ This is a new implementation of nested set based off of BetterNestedSet that fix
16
16
 
17
17
  == Usage
18
18
 
19
- To make use of awesome_nested_set, your model needs to have 3 fields: lft, rgt, and parent_id:
19
+ To make use of awesome_nested_set, your model needs to have 3 fields: lft, rgt, and parent_id.
20
+ You can also have an optional field: depth:
20
21
 
21
22
  class CreateCategories < ActiveRecord::Migration
22
23
  def self.up
@@ -25,6 +26,7 @@ To make use of awesome_nested_set, your model needs to have 3 fields: lft, rgt,
25
26
  t.integer :parent_id
26
27
  t.integer :lft
27
28
  t.integer :rgt
29
+ t.integer :depth # this is optional.
28
30
  end
29
31
  end
30
32
 
@@ -86,13 +88,13 @@ You can learn more about nested sets at: http://threebit.net/tutorials/nestedset
86
88
  If you find what you might think is a bug:
87
89
 
88
90
  1. Check the GitHub issue tracker to see if anyone else has had the same issue.
89
- http://github.com/collectiveidea/awesome_nested_set/issues/
91
+ https://github.com/collectiveidea/awesome_nested_set/issues/
90
92
  2. If you don't see anything, create an issue with information on how to reproduce it.
91
93
 
92
94
  If you want to contribute an enhancement or a fix:
93
95
 
94
- 1. Fork the project on github.
95
- http://github.com/collectiveidea/awesome_nested_set/
96
+ 1. Fork the project on GitHub.
97
+ https://github.com/collectiveidea/awesome_nested_set/
96
98
  2. Make your changes with tests.
97
99
  3. Commit the changes without making changes to the Rakefile, VERSION, or any other files that aren't related to your enhancement or fix
98
100
  4. Send a pull request.
@@ -448,12 +448,14 @@ module CollectiveIdea #:nodoc:
448
448
  end
449
449
 
450
450
  def set_depth!
451
- in_tenacious_transaction do
452
- reload
451
+ if nested_set_scope.column_names.map(&:to_s).include?(depth_column_name.to_s)
452
+ in_tenacious_transaction do
453
+ reload
453
454
 
454
- nested_set_scope.where(:id => id).update_all(["#{quoted_depth_column_name} = ?", level])
455
+ nested_set_scope.where(:id => id).update_all(["#{quoted_depth_column_name} = ?", level])
456
+ end
457
+ self[:depth] = self.level
455
458
  end
456
- self[:depth] = self.level
457
459
  end
458
460
 
459
461
  # on creation, set automatically lft and rgt to the end of the tree
@@ -1,3 +1,3 @@
1
1
  module AwesomeNestedSet
2
- VERSION = '2.1.0' unless defined?(::AwesomeNestedSet::VERSION)
3
- end
2
+ VERSION = '2.1.1' unless defined?(::AwesomeNestedSet::VERSION)
3
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awesome_nested_set
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
- - 0
10
- version: 2.1.0
9
+ - 1
10
+ version: 2.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brandon Keepers