Sha256: 8b6961f41c5c7e398a8d46acc7d1e3306a84ebc0d76e0990e48db453385da98e
Contents?: true
Size: 411 Bytes
Versions: 2
Compression:
Stored size: 411 Bytes
Contents
module ByStar module InstanceMethods def previous(options={}) field = options[:field] || self.class.by_star_field 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)).reorder("#{field} ASC").first end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
by_star-2.1.0.beta2 | lib/by_star/instance_methods.rb |
by_star-2.0.0.beta1 | lib/by_star/instance_methods.rb |