Advertisement
ChinaToster

Untitled

Jul 4th, 2019
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. class TodosController < ApplicationController
  2. def index
  3. @todos = Todo.all
  4. end
  5.  
  6. def update
  7.  
  8. end
  9.  
  10. def show
  11. @todo = Todo.find(params[:id])
  12. end
  13.  
  14. def new
  15. @todo = Project.new.todos.new
  16. end
  17.  
  18. def create
  19. @todo = Todo.new(todo_params)
  20.  
  21. if @todo.save
  22. redirect_to @todo
  23. else
  24. render 'new'
  25. end
  26. end
  27.  
  28.  
  29. private def todo_params
  30. params.require(:todo).permit(:text)
  31. end
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement