Class: Lists::ListsController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/lists/lists_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



10
11
12
13
14
# File 'app/controllers/lists/lists_controller.rb', line 10

def create
  @list = List.new(params[:list])
  @list.save
  respond_with @list
end

#destroyObject



33
34
35
36
37
# File 'app/controllers/lists/lists_controller.rb', line 33

def destroy
  @list = List.find(params[:id])
  @list.destroy
  respond_with @list
end

#editObject



21
22
23
24
25
# File 'app/controllers/lists/lists_controller.rb', line 21

def edit
  @list = List.find(params[:id])
  @list.list_items.build
  respond_with @list
end

#newObject



5
6
7
8
# File 'app/controllers/lists/lists_controller.rb', line 5

def new
  @list = List.new
  @list.list_items.build
end

#showObject



16
17
18
19
# File 'app/controllers/lists/lists_controller.rb', line 16

def show
  @list = List.find(params[:id])
  respond_with @list
end

#updateObject



27
28
29
30
31
# File 'app/controllers/lists/lists_controller.rb', line 27

def update
  @list = List.find(params[:id])
  @list.update_attributes(params[:list])
  respond_with @list
end