From 9a30d7be9db739d111ba0b5ce52d10f684291b19 Mon Sep 17 00:00:00 2001 From: Miha Mencin Date: Tue, 26 Mar 2019 11:39:54 +0100 Subject: [PATCH] SCI-3232 renaming the attribute name so it doesnt get 'constantized' --- app/controllers/result_assets_controller.rb | 2 +- app/controllers/result_tables_controller.rb | 2 +- app/controllers/result_texts_controller.rb | 2 +- app/controllers/results_controller.rb | 2 +- app/services/activities/create_activity_service.rb | 6 +++--- config/locales/global_activities/en.yml | 8 ++++---- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/controllers/result_assets_controller.rb b/app/controllers/result_assets_controller.rb index e29b08e20..3520626b2 100644 --- a/app/controllers/result_assets_controller.rb +++ b/app/controllers/result_assets_controller.rb @@ -225,7 +225,7 @@ class ResultAssetsController < ApplicationController project: @my_module.experiment.project, message_items: { result: result.id, - result_type: t('activities.result_type.asset') + type_of_result: t('activities.result_type.asset') }) end end diff --git a/app/controllers/result_tables_controller.rb b/app/controllers/result_tables_controller.rb index dce570bcb..f471566bf 100644 --- a/app/controllers/result_tables_controller.rb +++ b/app/controllers/result_tables_controller.rb @@ -190,7 +190,7 @@ class ResultTablesController < ApplicationController project: @my_module.experiment.project, message_items: { result: @result.id, - result_type: t('activities.result_type.table') + type_of_result: t('activities.result_type.table') }) end end diff --git a/app/controllers/result_texts_controller.rb b/app/controllers/result_texts_controller.rb index 5a6d78551..9121f0772 100644 --- a/app/controllers/result_texts_controller.rb +++ b/app/controllers/result_texts_controller.rb @@ -218,7 +218,7 @@ class ResultTextsController < ApplicationController project: @my_module.experiment.project, message_items: { result: @result.id, - result_type: t('activities.result_type.text') + type_of_result: t('activities.result_type.text') }) end end diff --git a/app/controllers/results_controller.rb b/app/controllers/results_controller.rb index 45272730e..40274e1cf 100644 --- a/app/controllers/results_controller.rb +++ b/app/controllers/results_controller.rb @@ -17,7 +17,7 @@ class ResultsController < ApplicationController team: @my_module.experiment.project.team, project: @my_module.experiment.project, message_items: { result: @result.id, - result_type: result_type }) + type_of_result: result_type }) flash[:success] = t('my_modules.module_archive.delete_flash', result: @result.name, module: @my_module.name) diff --git a/app/services/activities/create_activity_service.rb b/app/services/activities/create_activity_service.rb index b11ed7d2b..19e8fc03a 100644 --- a/app/services/activities/create_activity_service.rb +++ b/app/services/activities/create_activity_service.rb @@ -66,12 +66,12 @@ module Activities def try_to_constantize(key) const_name = key.to_s.camelize # Remove last part from and with '_xxx..x' - const_name_shorted = key.to_s.sub(/_[^_]*\z/, '').camelize + const_name_short = key.to_s.sub(/_[^_]*\z/, '').camelize if Extends::ACTIVITY_MESSAGE_ITEMS_TYPES.include? const_name const_name.constantize - elsif Extends::ACTIVITY_MESSAGE_ITEMS_TYPES.include? const_name_shorted - const_name_shorted.constantize + elsif Extends::ACTIVITY_MESSAGE_ITEMS_TYPES.include? const_name_short + const_name_short.constantize else false end diff --git a/config/locales/global_activities/en.yml b/config/locales/global_activities/en.yml index eaa2cc1e9..40e587e4c 100644 --- a/config/locales/global_activities/en.yml +++ b/config/locales/global_activities/en.yml @@ -32,13 +32,13 @@ en: create_report_html: "%{user} created report %{report}." edit_report_html: "%{user} edited report %{report}." delete_report_html: "%{user} deleted report %{report}." - add_result_html: "%{user} added %{result_type} result %{result}." - edit_result_html: "%{user} edited %{result_type} result %{result}." + add_result_html: "%{user} added %{type_of_result} result %{result}." + edit_result_html: "%{user} edited %{type_of_result} result %{result}." add_comment_to_result_html: "%{user} commented on result %{result}." edit_result_comment_html: "%{user} edited comment on result %{result}." delete_result_comment_html: "%{user} deleted comment on result %{result}." - archive_result_html: "%{user} archived %{result_type} result %{result}." - destroy_result_html: "%{user} deleted %{result_type} result %{result}." + archive_result_html: "%{user} archived %{type_of_result} result %{result}." + destroy_result_html: "%{user} deleted %{type_of_result} result %{result}." create_module_html: "%{user} created task %{my_module}." clone_module_html: "%{user} copied task %{my_module_new} from task %{my_module_original} as template." archive_module_html: "%{user} archived task %{my_module}."