a newbie here. Just started to learn development. Any help would be greatly appreciated
I have two models Project and Task. Each project will have 7 tasks. I want rails to auto create my 7 tasks after I create a project.
My Task Controller
def create
@task = Task.new(task_params)
respond_to do |format|
if @task.save
format.html { redirect_to @task, notice: 'Task was successfully created.' }
format.json { render :show, status: :created, location: @task }
else
format.html { render :new }
format.json { render json: @task.errors, status: :unprocessable_entity }
end
end
end
def task_params
params.require(:task).permit(:title, :description)
end