Hopfully fix #1025. It seems that editing a projects default_context with a context that does not exists just creates a new context for user_id=1, not the current user.

When you have context "A" and try to use context 'a' as default context Tracks could find "A" first and reference that one. PLease test.
This commit is contained in:
Reinier Balt 2010-08-06 10:20:31 +02:00
parent 158dc33176
commit 493ba616be

View file

@ -111,6 +111,7 @@ class ProjectsController < ApplicationController
params['project']['id'] = params['id']
params['project']['name'] = params['value']
end
@project.attributes = params['project']
@saved = @project.save
if @saved
@ -283,7 +284,7 @@ class ProjectsController < ApplicationController
p.delete('default_context_name')
unless default_context_name.blank?
default_context = Context.find_or_create_by_name(default_context_name)
default_context = current_user.contexts.find_or_create_by_name(default_context_name)
p['default_context_id'] = default_context.id
end
end