Module: Rango::GV::Scaffolding
- Extended by:
- RenderMixin
- Defined in:
- lib/rango/gv/scaffolding.rb
Class Method Summary collapse
- .create(klass, show_url) ⇒ Object
- .destroy(klass, list_url) ⇒ Object
- .list(klass) ⇒ Object
- .new(klass) ⇒ Object
- .show(klass) ⇒ Object
Methods included from RenderMixin
Class Method Details
.create(klass, show_url) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/rango/gv/scaffolding.rb', line 35 def self.create(klass, show_url) Rango::Mini.app do |request, response| klass.create!(params[:post]) response.redirect show_url end end |
.destroy(klass, list_url) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/rango/gv/scaffolding.rb', line 42 def self.destroy(klass, list_url) Rango::Mini.app do |request, response| object = klass.get(params[:id]) object.destroy response.redirect list_url end end |
.list(klass) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/rango/gv/scaffolding.rb', line 15 def self.list(klass) Rango::Mini.app do |request, response| objects = klass.all render "scaffolding/list.html", objects: objects end end |