Permalink
Browse files

Merge pull request #37 from hinrik/master

Prevent SQL error when position_column is not unique
  • Loading branch information...
2 parents 9df75e6 + 9a042f7 commit 8a6fd9319e055bdb495de7bfd39257bbd2124294 @swanandp committed May 14, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/acts_as_list/active_record/acts/list.rb
@@ -224,7 +224,7 @@ def bottom_position_in_list(except = nil)
def bottom_item(except = nil)
conditions = scope_condition
conditions = "#{conditions} AND #{self.class.primary_key} != #{except.id}" if except
- acts_as_list_class.unscoped.find(:first, :conditions => conditions, :order => "#{position_column} DESC")
+ acts_as_list_class.unscoped.find(:first, :conditions => conditions, :order => "#{acts_as_list_class.table_name}.#{position_column} DESC")
end
# Forces item to assume the bottom position in the list.

0 comments on commit 8a6fd93

Please sign in to comment.