diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-07-23 11:26:04 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-07-23 11:26:04 +0000 |
commit | d74f0bfd5c53962e332c2dd4d30dafaa1105b92b (patch) | |
tree | f3eaf66d67c3a87fb34340561bf188d364de623c /app/controllers/project_enumerations_controller.rb | |
parent | 41bb302594b48152b87c92f196c915f499093bbf (diff) | |
download | redmine-d74f0bfd5c53962e332c2dd4d30dafaa1105b92b.tar.gz redmine-d74f0bfd5c53962e332c2dd4d30dafaa1105b92b.zip |
Merged rails-5.1 branch (#23630).
git-svn-id: http://svn.redmine.org/redmine/trunk@16859 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/project_enumerations_controller.rb')
-rw-r--r-- | app/controllers/project_enumerations_controller.rb | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/app/controllers/project_enumerations_controller.rb b/app/controllers/project_enumerations_controller.rb index f68d94869..d9a77f969 100644 --- a/app/controllers/project_enumerations_controller.rb +++ b/app/controllers/project_enumerations_controller.rb @@ -20,15 +20,8 @@ class ProjectEnumerationsController < ApplicationController before_action :authorize def update - if params[:enumerations] - saved = Project.transaction do - params[:enumerations].each do |id, activity| - @project.update_or_create_time_entry_activity(id, activity) - end - end - if saved - flash[:notice] = l(:notice_successful_update) - end + if @project.update_or_create_time_entry_activities(update_params) + flash[:notice] = l(:notice_successful_update) end redirect_to settings_project_path(@project, :tab => 'activities') @@ -41,4 +34,12 @@ class ProjectEnumerationsController < ApplicationController flash[:notice] = l(:notice_successful_update) redirect_to settings_project_path(@project, :tab => 'activities') end + + private + + def update_params + params. + permit(:enumerations => [:parent_id, :active, {:custom_field_values => {}}]). + require(:enumerations) + end end |