Sha256: cb3c4a10069b0a0c827d71978a71078a22b32b677ee53736b762274552fde60a
Contents?: true
Size: 572 Bytes
Versions: 8
Compression:
Stored size: 572 Bytes
Contents
module Ohm # Dirt cheap ::first and ::last support. # # @example # # class Post < Ohm::Model # include Ohm::Boundaries # end # # post1 = Post.create # post2 = Post.create # post1 == Post.first # # => true # # post2 == Post.last # # => true module Boundaries def self.included(base) base.extend ClassMethods end module ClassMethods def first all.first end # @todo Add support for passing in conditions def last self[db.get(key(:id))] end end end end
Version data entries
8 entries across 8 versions & 1 rubygems