Class: ActionFramework::ModelHelper
- Inherits:
-
Object
- Object
- ActionFramework::ModelHelper
- Defined in:
- lib/actionframework/modelhelper.rb
Class Method Summary collapse
Class Method Details
.get(model, res) ⇒ Object
9 10 11 12 13 |
# File 'lib/actionframework/modelhelper.rb', line 9 def self.get model,res response = model.all.to_json res.write response res.finish end |
.post(model, res) ⇒ Object
3 4 5 6 7 |
# File 'lib/actionframework/modelhelper.rb', line 3 def self.post model,res response = model.create(JSON.parse(req.body.string)).to_json res.write response res.finish end |
.update(model, res) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/actionframework/modelhelper.rb', line 15 def self.update model,res doc = JSON.parse(req.body.string) modelfind = model.where(doc[:where]) response = modelfind.update_attributes(doc[:attributes]).to_json res.write response res.finish end |