# find first foo
foo = Foo.first
# find next foo
next_foo = foo.next
# find next foo with defined sort column or conditions
next_foo = foo.next(:sort => :age, :conditions ...)
# previous function also.
previous_foo = foo.previous
#...
Devoting for Ruby, Rails and Web development
# find first foo
foo = Foo.first
# find next foo
next_foo = foo.next
# find next foo with defined sort column or conditions
next_foo = foo.next(:sort => :age, :conditions ...)
# previous function also.
previous_foo = foo.previous
#...