Class: InstancesController

Inherits:
MVCLI::Controller
  • Object
show all
Defined in:
app/controllers/instances_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/instances_controller.rb', line 14

def create
  template = Instances::CreateForm
  argv = MVCLI::Argv.new command.argv
  form = template.new argv.options
  form.validate!

  #How expansive do we want these command line options to be?
  options = {
    name: form.name,
    flavor_id: form.flavor,
    volume_size: form.size
  }
  instances.create options
end

#destroyObject



29
30
31
32
33
# File 'app/controllers/instances_controller.rb', line 29

def destroy
  instance.tap do |i|
    i.destroy
  end
end

#indexObject



6
7
8
# File 'app/controllers/instances_controller.rb', line 6

def index
  instances.all
end

#showObject



10
11
12
# File 'app/controllers/instances_controller.rb', line 10

def show
  instance.reload
end