Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fix deprecation warnings for ActiveRecord 4 #125

Closed
wants to merge 1 commit into from

3 participants

@NARKOZ

No description provided.

@adammck

:-1: This is a great start, but doesn't resolve all of the deprecation warnings.

@NARKOZ

@adammck agree, I was going for MVP here. Closing due #126.

@NARKOZ NARKOZ closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 8, 2013
  1. @NARKOZ
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 8 deletions.
  1. +8 −8 lib/ancestry/instance_methods.rb
View
16 lib/ancestry/instance_methods.rb
@@ -27,7 +27,7 @@ def update_descendants_with_new_ancestry
end
end
end
-
+
# Apply orphan strategy
def apply_orphan_strategy
# Skip this if callbacks are disabled
@@ -145,7 +145,7 @@ def children
end
def child_ids
- children.all(:select => self.base_class.primary_key).map(&self.base_class.primary_key.to_sym)
+ children.select(self.base_class.primary_key).map(&self.base_class.primary_key.to_sym)
end
def has_children?
@@ -166,7 +166,7 @@ def siblings
end
def sibling_ids
- siblings.all(:select => self.base_class.primary_key).collect(&self.base_class.primary_key.to_sym)
+ siblings.select(self.base_class.primary_key).collect(&self.base_class.primary_key.to_sym)
end
def has_siblings?
@@ -187,7 +187,7 @@ def descendants depth_options = {}
end
def descendant_ids depth_options = {}
- descendants(depth_options).all(:select => self.base_class.primary_key).collect(&self.base_class.primary_key.to_sym)
+ descendants(depth_options).select(self.base_class.primary_key).collect(&self.base_class.primary_key.to_sym)
end
# Subtree
@@ -200,7 +200,7 @@ def subtree depth_options = {}
end
def subtree_ids depth_options = {}
- subtree(depth_options).all(:select => self.base_class.primary_key).collect(&self.base_class.primary_key.to_sym)
+ subtree(depth_options).select(self.base_class.primary_key).collect(&self.base_class.primary_key.to_sym)
end
# Callback disabling
@@ -229,16 +229,16 @@ def primary_key_type
end
def unscoped_descendants
self.base_class.unscoped do
- self.base_class.all(:conditions => descendant_conditions)
+ self.base_class.where descendant_conditions
end
end
-
+
# basically validates the ancestry, but also applied if validation is
# bypassed to determine if chidren should be affected
def sane_ancestry?
ancestry.nil? || (ancestry.to_s =~ Ancestry::ANCESTRY_PATTERN && !ancestor_ids.include?(self.id))
end
-
+
def unscoped_find id
self.base_class.unscoped { self.base_class.find(id) }
end
Something went wrong with that request. Please try again.