Skip to content

Commit

Permalink
Ancestry 1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
stefankroes committed Oct 24, 2010
1 parent 648a79c commit e84fa5e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions README.rdoc
Expand Up @@ -227,13 +227,14 @@ The materialised path pattern requires Ancestry to use a 'like' condition in ord

= Version history

The latest and recommended version of ancestry is 1.2.0. The three numbers of each version numbers are respectively the major, minor and patch versions. We started with major version 1 because it looks so much better and ancestry was already quite mature and complete when it was published. The major version is only bumped when backwards compatibility is broken. The minor version is bumped when new features are added. The patch version is bumped when bugs are fixed.
The latest and recommended version of ancestry is 1.2.2. The three numbers of each version numbers are respectively the major, minor and patch versions. We started with major version 1 because it looks so much better and ancestry was already quite mature and complete when it was published. The major version is only bumped when backwards compatibility is broken. The minor version is bumped when new features are added. The patch version is bumped when bugs are fixed.

- Version 1.2.1 (2010-10-24)
- Version 1.2.2 (2010-10-24)
- Fixed all deprecation warnings for rails 3.0.X
- Added :report option to check_ancestry_integrity!
- Changed ActiveRecord dependency to 2.2.2
- Tested and fixed for ruby 1.8.7 and 1.9.2
- Changed usage of update_attributes to update_attribute to allow ancestry column protection
- Version 1.2.0 (2009-11-07)
- Removed some duplication in has_ancestry
- Cleaned up plugin pattern according to http://yehudakatz.com/2009/11/12/better-ruby-idioms/
Expand Down
4 changes: 2 additions & 2 deletions ancestry.gemspec
Expand Up @@ -3,8 +3,8 @@ Gem::Specification.new do |s|
s.description = 'Organise ActiveRecord model into a tree structure'
s.summary = 'Ancestry allows the records of a ActiveRecord model to be organised in a tree structure, using a single, intuitively formatted database column. It exposes all the standard tree structure relations (ancestors, parent, root, children, siblings, descendants) and all of them can be fetched in a single sql query. Additional features are named_scopes, integrity checking, integrity restoration, arrangement of (sub)tree into hashes and different strategies for dealing with orphaned records.'

s.version = '1.2.1'
s.date = '2010-01-27'
s.version = '1.2.2'
s.date = '2010-10-24'

s.author = 'Stefan Kroes'
s.email = 's.a.kroes@gmail.com'
Expand Down
4 changes: 2 additions & 2 deletions lib/ancestry/class_methods.rb
Expand Up @@ -90,7 +90,7 @@ def restore_ancestry_integrity!
# ... set its ancestry to nil if invalid
if node.errors[node.class.ancestry_column].blank?
node.without_ancestry_callbacks do
node.update_attributes :ancestry => nil
node.update_attribute node.ancestry_column, nil
end
end
# ... save parent of this node in parents array if it exists
Expand All @@ -111,7 +111,7 @@ def restore_ancestry_integrity!
ancestry, parent = if ancestry.nil? then parent else "#{parent}/#{ancestry}" end, parents[parent]
end
node.without_ancestry_callbacks do
node.update_attributes node.ancestry_column => ancestry
node.update_attribute node.ancestry_column, ancestry
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/ancestry/instance_methods.rb
Expand Up @@ -15,8 +15,8 @@ def update_descendants_with_new_ancestry
descendants.each do |descendant|
# ... replace old ancestry with new ancestry
descendant.without_ancestry_callbacks do
descendant.update_attributes(
self.base_class.ancestry_column =>
descendant.update_attribute(
self.base_class.ancestry_column,
descendant.read_attribute(descendant.class.ancestry_column).gsub(
/^#{self.child_ancestry}/,
if read_attribute(self.class.ancestry_column).blank? then id.to_s else "#{read_attribute self.class.ancestry_column }/#{id}" end
Expand All @@ -38,7 +38,7 @@ def apply_orphan_strategy
if self.base_class.orphan_strategy == :rootify
descendants.each do |descendant|
descendant.without_ancestry_callbacks do
descendant.update_attributes descendant.class.ancestry_column => (if descendant.ancestry == child_ancestry then nil else descendant.ancestry.gsub(/^#{child_ancestry}\//, '') end)
descendant.update_attribute descendant.class.ancestry_column, (if descendant.ancestry == child_ancestry then nil else descendant.ancestry.gsub(/^#{child_ancestry}\//, '') end)
end
end
# ... destroy all descendants if orphan strategy is destroy
Expand Down

0 comments on commit e84fa5e

Please sign in to comment.