Skip to content
Browse files

Use reorder in previous+next to ensure that no other order clause int…

…erferes
  • Loading branch information...
1 parent 42b3437 commit 7eeca50f97ebaf488c547151d560938921dfe55a @radar committed Feb 19, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/by_star/instance_methods.rb
View
4 lib/by_star/instance_methods.rb
@@ -2,12 +2,12 @@ module ByStar
module InstanceMethods
def previous(options={})
field = options[:field] || self.class.by_star_field
- self.class.where("#{field} < ?", self.send(field)).order("#{field} DESC").first
+ self.class.where("#{field} < ?", self.send(field)).reorder("#{field} DESC").first
end
def next(options={})
field = options[:field] || self.class.by_star_field
- self.class.where("#{field} > ?", self.send(field)).order("#{field} ASC").first
+ self.class.where("#{field} > ?", self.send(field)).reorder("#{field} ASC").first
end
end
end

0 comments on commit 7eeca50

Please sign in to comment.
Something went wrong with that request. Please try again.