Skip to content

Commit

Permalink
Merge pull request #37 from hinrik/master
Browse files Browse the repository at this point in the history
Prevent SQL error when position_column is not unique
  • Loading branch information
swanandp committed May 14, 2012
2 parents 9df75e6 + 9a042f7 commit 8a6fd93
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/acts_as_list/active_record/acts/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8a6fd93

Please sign in to comment.