Class: Ext::OgScaffold::OgScaffolder

Inherits:
Equipment::Resource::RestController
  • Object
show all
Defined in:
lib/ext/og_scaffold.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.modelObject

Returns the value of attribute model.



48
49
50
# File 'lib/ext/og_scaffold.rb', line 48

def model
  @model
end

Instance Method Details

#createObject

CRUD ###



52
53
54
55
56
57
58
# File 'lib/ext/og_scaffold.rb', line 52

def create
  m = model.new
  input.fill(m) # TODO : Make this work
  m.save
  flash.errors = m.errors
  redirect R(self, :show, m.oid)
end

#destroy(oid) ⇒ Object



74
75
76
77
# File 'lib/ext/og_scaffold.rb', line 74

def destroy(oid)
  flash.errors = model.delete(oid)        
  redirect R(self)
end

#edit(oid) ⇒ Object



86
87
88
89
90
# File 'lib/ext/og_scaffold.rb', line 86

def edit(oid)
  @model = model
  @model_instance = model[oid]
  render :edit
end

#indexObject

Views ###



81
82
83
84
# File 'lib/ext/og_scaffold.rb', line 81

def index
  @model = model
  render :index
end

#show(oid) ⇒ Object



60
61
62
63
64
# File 'lib/ext/og_scaffold.rb', line 60

def show(oid)
  @model = model
  @model_instance = model[oid]
  render :show
end

#update(oid) ⇒ Object



66
67
68
69
70
71
72
# File 'lib/ext/og_scaffold.rb', line 66

def update(oid)
  m = model[oid]
  input.fill(m)
  m.save
  flash.errors = m.errors
  redirect R(self, :show, m.oid)
end