diff options
Diffstat (limited to 'activerecord/lib/active_record/acts')
-rw-r--r-- | activerecord/lib/active_record/acts/list.rb | 9 | ||||
-rw-r--r-- | activerecord/lib/active_record/acts/nested_set.rb | 8 |
2 files changed, 7 insertions, 10 deletions
diff --git a/activerecord/lib/active_record/acts/list.rb b/activerecord/lib/active_record/acts/list.rb index eb3993a92b..6c908c88a4 100644 --- a/activerecord/lib/active_record/acts/list.rb +++ b/activerecord/lib/active_record/acts/list.rb @@ -135,14 +135,14 @@ module ActiveRecord def higher_item return nil unless in_list? - self.class.find_first( + self.class.find(:first, :conditions => "#{scope_condition} AND #{position_column} = #{(send(position_column).to_i - 1).to_s}" ) end def lower_item return nil unless in_list? - self.class.find_first( + self.class.find(:first, :conditions => "#{scope_condition} AND #{position_column} = #{(send(position_column).to_i + 1).to_s}" ) end @@ -169,10 +169,7 @@ module ActiveRecord end def bottom_item - self.class.find_first( - "#{scope_condition} ", - "#{position_column} DESC" - ) + self.class.find(:first, :conditions => scope_condition, :order => "#{position_column} DESC") end def assume_bottom_position diff --git a/activerecord/lib/active_record/acts/nested_set.rb b/activerecord/lib/active_record/acts/nested_set.rb index 0202ac65b4..cc120cad4b 100644 --- a/activerecord/lib/active_record/acts/nested_set.rb +++ b/activerecord/lib/active_record/acts/nested_set.rb @@ -181,17 +181,17 @@ module ActiveRecord # Returns a set of itself and all of it's nested children def full_set - self.class.find_all( "#{scope_condition} AND (#{left_col_name} BETWEEN #{self[left_col_name]} and #{self[right_col_name]})" ) + self.class.find(:all, :conditions => "#{scope_condition} AND (#{left_col_name} BETWEEN #{self[left_col_name]} and #{self[right_col_name]})" ) end # Returns a set of all of it's children and nested children def all_children - self.class.find_all( "#{scope_condition} AND (#{left_col_name} > #{self[left_col_name]}) and (#{right_col_name} < #{self[right_col_name]})" ) + self.class.find(:all, :conditions => "#{scope_condition} AND (#{left_col_name} > #{self[left_col_name]}) and (#{right_col_name} < #{self[right_col_name]})" ) end # Returns a set of only this entries immediate children def direct_children - self.class.find_all( "#{scope_condition} and #{parent_column} = #{self.id}") + self.class.find(:all, :conditions => "#{scope_condition} and #{parent_column} = #{self.id}") end # Prunes a branch off of the tree, shifting all of the elements on the right @@ -209,4 +209,4 @@ module ActiveRecord end end end -end
\ No newline at end of file +end |