Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TodosController < ApplicationController
- def index
- @todos = Todo.all
- end
- def update
- end
- def show
- @todo = Todo.find(params[:id])
- end
- def new
- @todo = Project.new.todos.new end
- end
- def create
- @todo = Todo.new(todo_params)
- if @todo.save
- redirect_to @todo, notice: 'Todo was successfully created.'
- else
- render 'new'
- end
- end
- private def todo_params
- params.require(:todo).permit(:text)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement