I\'m new in Rails... smile
In my blog aplication I want to have a \"Previous post\" link and a \"Next post\" link in the bottom of my show view.
How do I do
I've created gem proximal_records especially for this kind of task and it works on any dynamically created scope in your model.
https://github.com/dmitry/proximal_records
Basic example:
class Article < ActiveRecord::Base
include ProximalRecords
end
scope = Article.title_like('proximal').order('created_at DESC, title ASC')
current_record = scope.to_a[5]
p, n = current_record.proximal_records(scope) # will find record 5 and 7