mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-08 21:52:36 +01:00
fix #1265. The validations were not checked when making a project out of a todo. Thanks popsch for spotting this one!
This commit is contained in:
parent
ff4a376ee9
commit
bb998ba3fa
1 changed files with 10 additions and 3 deletions
|
|
@ -846,9 +846,16 @@ class TodosController < ApplicationController
|
||||||
@todo = current_user.todos.find(params[:id])
|
@todo = current_user.todos.find(params[:id])
|
||||||
@project = current_user.projects.new(:name => @todo.description, :description => @todo.notes,
|
@project = current_user.projects.new(:name => @todo.description, :description => @todo.notes,
|
||||||
:default_context => @todo.context)
|
:default_context => @todo.context)
|
||||||
@todo.destroy
|
|
||||||
@project.save!
|
|
||||||
redirect_to project_url(@project)
|
unless @project.invalid?
|
||||||
|
@todo.destroy
|
||||||
|
@project.save!
|
||||||
|
redirect_to project_url(@project)
|
||||||
|
else
|
||||||
|
flash[:error] = "Could not create project from todo: #{@project.errors.full_messages[0]}"
|
||||||
|
redirect_to request.env["HTTP_REFERER"] || root_url
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_notes
|
def show_notes
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue