Sha256: db2268111199b7605eb3f576417337861cb862e7a21d29d47093791e3faf91c3
Contents?: true
Size: 485 Bytes
Versions: 4
Compression:
Stored size: 485 Bytes
Contents
module ByStar module Neighbours # Find the previous record to this. def previous(field=nil) field = field || self.class.by_star_field self.class.past(self.send(field.to_s.split(".").last)) { { :order => "#{field} DESC" }}.first end # Find the next record to this. def next(field=nil) field = field || self.class.by_star_field self.class.future(self.send(field.to_s.split(".").last)) { { :order => "#{field} ASC" }}.first end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
by_star-1.0.1 | lib/by_star/neighbours.rb |
by_star-1.0.0 | lib/by_star/neighbours.rb |
by_star-0.9.0 | lib/neighbours.rb |
by_star-0.8.0 | lib/neighbours.rb |