Module: NeoGruby::Sequel::Plugins::UuidPk::ClassMethods

Defined in:
lib/neo_gruby/sequel/plugins/uuid_pk.rb

Instance Method Summary collapse

Instance Method Details

#[](value) ⇒ Object



37
38
39
# File 'lib/neo_gruby/sequel/plugins/uuid_pk.rb', line 37

def [](value)
  super(UuidPk.parse_id(value, true))
end

#find(where) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/neo_gruby/sequel/plugins/uuid_pk.rb', line 19

def find(where)
  if where.is_a? Hash
    where[:id] = UuidPk.parse_id(where[:id], true) if where[:id]
    where['id'] = UuidPk.parse_id(where['id'], true) if where['id']
  end
        
  super(where)
end

#where(params) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/neo_gruby/sequel/plugins/uuid_pk.rb', line 28

def where(params)
  if params.is_a? Hash
    params[:id] = UuidPk.parse_id(params[:id], true) if params[:id]
    params['id'] = UuidPk.parse_id(params['id'], true) if params['id']
  end
        
  super(params)
end