module Sequel::Plugins::HashId::DatasetMethods

Public Instance Methods

with_hashid(hashid) click to toggle source

Lookup a record with a hashid, returning nil if none is found

# File lib/sequel/plugins/hash_id.rb, line 46
def with_hashid(hashid)
  id ,= model.hasher.decode(hashid)

  self[id] if id
end
with_hashid!(hashid) click to toggle source

Lookup a record with a hashid, raising Sequel::NoMatchingError if not found

# File lib/sequel/plugins/hash_id.rb, line 54
def with_hashid!(hashid)
  id ,= model.hasher.decode(hashid)

  with_pk!(id)
end