Module: SlAah::ClassMethods

Defined in:
lib/models/sl_aah.rb

Instance Method Summary collapse

Instance Method Details

#allObject



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

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

#delete(pk) ⇒ Object



33
34
35
36
# File 'lib/models/sl_aah.rb', line 33

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

#get(hash) ⇒ Object



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

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

#set(attributes) ⇒ Object



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

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

#set!(attributes) ⇒ Object



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

def set!(attributes)
  user = SlUser.new attributes
  user.save!
  user
end