From 62d749ab0ef1787e050537bd9a6f833b30f1331d Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Sat, 14 Jan 2006 09:26:14 +0000 Subject: [PATCH] Don't hardcode id in acts_as_list. Closes #3370 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3421 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/CHANGELOG | 4 +++- activerecord/lib/active_record/acts/list.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 447ce724e4..12d91b5a98 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,8 +1,10 @@ *SVN* +* Don't hardcode 'id' in acts as list. [ror@philippeapril.com] + * Fix date errors for SQLServer in association tests. #3406 [kevin.clark@gmal.com] -r Escape database name in MySQL adapter when creating and dropping databases. #3409 [anna@wota.jp] +* Escape database name in MySQL adapter when creating and dropping databases. #3409 [anna@wota.jp] * Disambiguate table names for columns in validates_uniquness_of's WHERE clause. #3423 [alex.borovsky@gmail.com] diff --git a/activerecord/lib/active_record/acts/list.rb b/activerecord/lib/active_record/acts/list.rb index ce1c59d422..0e0e1e4f36 100644 --- a/activerecord/lib/active_record/acts/list.rb +++ b/activerecord/lib/active_record/acts/list.rb @@ -174,7 +174,7 @@ def bottom_position_in_list(except = nil) def bottom_item(except = nil) conditions = scope_condition - conditions = "#{conditions} AND id != #{except.id}" if except + conditions = "#{conditions} AND #{self.class.primary_key} != #{except.id}" if except acts_as_list_class.find(:first, :conditions => conditions, :order => "#{position_column} DESC") end -- GitLab