ChinaToster

Untitled

Jul 4th, 2019
678
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 end
  16.   end
  17.  
  18. def create
  19.     @todo = Todo.new(todo_params)
  20.  
  21.       if @todo.save
  22.         redirect_to @todo, notice: 'Todo was successfully created.'
  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
RAW Paste Data