Module: DmAdapter::ClassMethods
- Defined in:
- lib/models/dm_adapter.rb
Instance Method Summary collapse
-
#all(*args) ⇒ Object
pass all args to this.
- #delete(pk) ⇒ Object
- #get(hash) ⇒ Object
- #set(attributes) ⇒ Object
- #set!(attributes) ⇒ Object
Instance Method Details
#all(*args) ⇒ Object
pass all args to this
9 10 11 12 |
# File 'lib/models/dm_adapter.rb', line 9 def all(*args) result = DmUser.all(*args) result.collect {|instance| self.new instance} end |
#delete(pk) ⇒ Object
34 35 36 37 |
# File 'lib/models/dm_adapter.rb', line 34 def delete(pk) user = DmUser.first(:id => pk) user.destroy end |
#get(hash) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/models/dm_adapter.rb', line 14 def get(hash) if user = DmUser.first(hash) self.new user else nil end end |
#set(attributes) ⇒ Object
22 23 24 25 26 |
# File 'lib/models/dm_adapter.rb', line 22 def set(attributes) user = DmUser.new attributes user.save user end |
#set!(attributes) ⇒ Object
28 29 30 31 32 |
# File 'lib/models/dm_adapter.rb', line 28 def set!(attributes) user = DmUser.new attributes user.save! user end |