Project

General

Profile

Actions

Defect #24

closed

SVN Repository attributes aren't saved if modified after creation

Added by Antonio Salazar over 17 years ago. Updated over 17 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

If one changes the SVN repository path after one has created and set it already, the path is not updated. This seems
to be because of this bit in projects_controller.rb:

if params[:repository_enabled]
case params[:repository_enabled]
when "0"
@project.repository = nil
when "1"
@project.repository ||= Repository.new
@project.repository.attributes = params[:repository]
end
end

This seems to be fixed in trunk, but the fix is:

if params[:repository_enabled] && params[:repository_enabled] == "1" 
@project.repository = Repository.new
@project.repository.attributes = params[:repository]
end

Which would generate a new Repository every time a modification was made. It seems like a better solution would be:

if params[:repository_enabled]
case params[:repository_enabled]
when "0"
@project.repository = nil
when "1"
@project.repository ||= Repository.new
@project.repository.update_attributes params[:repository] # use update_attributes
end
end

If the update were to fail, then the save of the project would also fail due to the validate_associated validation in
the Project model. Otherwise, whether it was or was not a new Repository, it would update the attributes and save, and
only generate a new Repository once, when there was no previous one to update.

A similar solution would probably work for the wiki.

Actions

Also available in: Atom PDF