mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 11:10:12 +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])
|
||||
@project = current_user.projects.new(:name => @todo.description, :description => @todo.notes,
|
||||
: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
|
||||
|
||||
def show_notes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue