Class: UsersController

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

Instance Method Summary collapse

Instance Method Details

#createObject



10
11
12
13
14
15
16
# File 'app/controllers/users_controller.rb', line 10

def create
  template = Users::CreateForm
  argv = MVCLI::Argv.new command.argv
  form = template.new argv.options
  form.validate!
  instance.users.create form.value
end

#destroyObject



24
25
26
27
28
29
# File 'app/controllers/users_controller.rb', line 24

def destroy
  list = users
  list.instance = instance
  user = list.all.find { |u| u.name == params[:id] }
  user.destroy or fail Fog::Errors::NotFound
end

#indexObject



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

def index
  instance.users.all
end

#showObject



18
19
20
21
22
# File 'app/controllers/users_controller.rb', line 18

def show
  list = users
  list.instance = instance
  list.all.find { |u| u.name == params[:id] } or fail Fog::Errors::NotFound
end