Class: TodosController
Instance Attribute Summary
#params, #req, #res
Instance Method Summary
collapse
#already_built_response?, #flash, #initialize, #invoke_action, #redirect_to, #render, #render_content, #session
included
Instance Method Details
#create ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'lib/reloj/skeletons/sample_app/app/controllers/todos_controller.rb', line 13
def create
@todo = Todo.new(params[:todo])
if @todo.title == "" || @todo.save
redirect_to "/"
else
render :new
end
end
|
#destroy ⇒ Object
22
23
24
25
26
|
# File 'lib/reloj/skeletons/sample_app/app/controllers/todos_controller.rb', line 22
def destroy
@todo = Todo.find(params[:id])
@todo.destroy
render_content("{}", "application/json")
end
|
#index ⇒ Object
3
4
5
6
|
# File 'lib/reloj/skeletons/sample_app/app/controllers/todos_controller.rb', line 3
def index
@todos = Todo.all
render :index
end
|
#new ⇒ Object
8
9
10
11
|
# File 'lib/reloj/skeletons/sample_app/app/controllers/todos_controller.rb', line 8
def new
@todo = Todo.new
render :new
end
|