Sha256: 1b4a603ab44f2acaa91be81380d7187e55867e9b47da05325208836f1b35b749

Contents?: true

Size: 380 Bytes

Versions: 1

Compression:

Stored size: 380 Bytes

Contents

class Post #< DataMapper::Base
  include DataMapper::Persistence
  
  property :title, :string
  property :created_at, :datetime
  
  def next
    Post.first(:created_at.gte => self.created_at, :id.gt => self.id, :order => "created_at, id")
  end

  def previous
    Post.first(:created_at.lte => self.created_at, :id.lt => self.id, :order => "created_at DESC, id DESC")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datamapper-0.2.5 spec/models/post.rb