mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
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:
parent
158dc33176
commit
493ba616be
1 changed files with 2 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue