Class: TodosController
- Inherits:
-
Reloj::ControllerBase
- Object
- Reloj::ControllerBase
- TodosController
- Defined in:
- lib/reloj/skeletons/sample_app/app/controllers/todos_controller.rb
Instance Attribute Summary
Attributes inherited from Reloj::ControllerBase
Instance Method Summary collapse
Methods inherited from Reloj::ControllerBase
#already_built_response?, #flash, #initialize, #invoke_action, #redirect_to, #render, #render_content, #session
Methods included from RouteHelper
Constructor Details
This class inherits a constructor from Reloj::ControllerBase
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 |