Module: DmAdapter::ClassMethods

Defined in:
lib/models/dm_adapter.rb

Instance Method Summary collapse

Instance Method Details

#allObject



8
9
10
11
# File 'lib/models/dm_adapter.rb', line 8

def all
  result = DmUser.all
  result.collect {|instance| self.new instance}
end

#delete(pk) ⇒ Object



27
28
29
30
# File 'lib/models/dm_adapter.rb', line 27

def delete(pk)
  user = User.first(:id => pk)
  user.destroy
end

#get(hash) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/models/dm_adapter.rb', line 13

def get(hash)
  if user = DmUser.first(hash)
    self.new user
  else
    nil
  end
end

#set(attributes) ⇒ Object



21
22
23
24
25
# File 'lib/models/dm_adapter.rb', line 21

def set(attributes)
  user = DmUser.new attributes
  user.save
  user
end