Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…erferes
  • Loading branch information...
commit 7eeca50f97ebaf488c547151d560938921dfe55a 1 parent 42b3437
@radar authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.