From 04d5f405ae3894c6905181b26089e0a5cb4453b3 Mon Sep 17 00:00:00 2001 From: Andrew Rogachevich Date: Mon, 31 Jul 2017 18:01:40 +0300 Subject: [PATCH] Add extra_info to safe_attributes --- app/models/repository/git_remote.rb | 2 ++ lib/redmine_git_remote/repositories_helper_patch.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/repository/git_remote.rb b/app/models/repository/git_remote.rb index f5c0b2d..a16cf30 100644 --- a/app/models/repository/git_remote.rb +++ b/app/models/repository/git_remote.rb @@ -11,6 +11,8 @@ class Repository::GitRemote < Repository::Git before_validation :initialize_clone + safe_attributes 'extra_info', :if => lambda {|repository, _user| repository.new_record?} + # TODO: figure out how to do this safely (if at all) # before_deletion :rm_removed_repo # def rm_removed_repo diff --git a/lib/redmine_git_remote/repositories_helper_patch.rb b/lib/redmine_git_remote/repositories_helper_patch.rb index 508ac53..ea6ad68 100644 --- a/lib/redmine_git_remote/repositories_helper_patch.rb +++ b/lib/redmine_git_remote/repositories_helper_patch.rb @@ -12,7 +12,7 @@ module RedmineGitRemote :label => l(:field_path_to_repository)) + content_tag('em', l(:text_git_remote_path_note), :class => 'info') + form.text_field(:extra_clone_url, :size => 60, :required => true, - :disabled => !repository.safe_attribute?('url')) + + :disabled => !repository.safe_attribute?('url'), name: 'repository[extra_info][extra_clone_url]') + content_tag('em', l(:text_git_remote_url_note), :class => 'info') ) end