diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2018-09-15 06:47:03 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2018-09-15 06:47:03 +0000 |
commit | 9116b030a0bd65c8d65d795bfe97a491f5dd0e4c (patch) | |
tree | 0781eac554d3718a4bd3b78d5a75d633f1e3be2d /app | |
parent | aa82fdd95ef7adaddc2d37c71857868d6e1d3e21 (diff) | |
download | redmine-9116b030a0bd65c8d65d795bfe97a491f5dd0e4c.tar.gz redmine-9116b030a0bd65c8d65d795bfe97a491f5dd0e4c.zip |
Merged r17484 to 3.4-stable (#28925).
git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@17485 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/enumerations_controller.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb index e5e3cc3de..a04d7b184 100644 --- a/app/controllers/enumerations_controller.rb +++ b/app/controllers/enumerations_controller.rb @@ -91,8 +91,10 @@ class EnumerationsController < ApplicationController def build_new_enumeration class_name = params[:enumeration] && params[:enumeration][:type] || params[:type] - @enumeration = Enumeration.new_subclass_instance(class_name, enumeration_params) - if @enumeration.nil? + @enumeration = Enumeration.new_subclass_instance(class_name) + if @enumeration + @enumeration.attributes = enumeration_params || {} + else render_404 end end @@ -105,6 +107,7 @@ class EnumerationsController < ApplicationController def enumeration_params # can't require enumeration on #new action - params.permit(:enumeration => [:name, :active, :is_default, :position])[:enumeration] + cf_ids = @enumeration.available_custom_fields.map{|c| c.id.to_s} + params.permit(:enumeration => [:name, :active, :is_default, :position, :custom_field_values => cf_ids])[:enumeration] end end |