Class: TodosController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- TodosController
- Defined in:
- lib/app/controllers/todos_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
21 22 23 24 25 |
# File 'lib/app/controllers/todos_controller.rb', line 21 def create @todo = @calendar.todos.create(params[:todo]) flash[:notice] = "Todo successfully created" if @todo.save respond_with(@calendar, @todo) end |
#destroy ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/app/controllers/todos_controller.rb', line 33 def destroy @todo = @calendar.todos.find(params[:id]) @todo.destroy respond_to do |format| format.html { redirect_to(calendars_todos_url(@calendar, @todo)) } format.xml { head :ok } end end |
#edit ⇒ Object
17 18 19 |
# File 'lib/app/controllers/todos_controller.rb', line 17 def edit respond_with(@calendar, (@todo = @calendar.todos.find(params[:id]))) end |
#index ⇒ Object
5 6 7 |
# File 'lib/app/controllers/todos_controller.rb', line 5 def index respond_with(@calendar, (@todos = @calendar.todos.all)) end |
#new ⇒ Object
13 14 15 |
# File 'lib/app/controllers/todos_controller.rb', line 13 def new respond_with(@calendar, (@todo = @calendar.todos.new)) end |
#show ⇒ Object
9 10 11 |
# File 'lib/app/controllers/todos_controller.rb', line 9 def show respond_with(@calendar, (@todo = @calendar.todos.find(params[:id]))) end |
#update ⇒ Object
27 28 29 30 31 |
# File 'lib/app/controllers/todos_controller.rb', line 27 def update @todo = @calendar.todos.find(params[:id]) @todo.update_attributes(params[:calendar]) respond_with(@calendar, @todo) end |