diff --git a/app/models/activity.rb b/app/models/activity.rb
index 9d483a4d3..47541a78f 100644
--- a/app/models/activity.rb
+++ b/app/models/activity.rb
@@ -83,20 +83,24 @@ class Activity < ActiveRecord::Base
.url_helpers
.project_path(project)}'>
#{project.name}"
- experiment_m = "| #{I18n.t('search.index.experiment')}
-
- #{experiment.name}" if experiment
- task_m = "| #{I18n.t('search.index.module')}
-
- #{my_module.name}" if my_module
+ if experiment
+ experiment_m = "| #{I18n.t('search.index.experiment')}
+
+ #{experiment.name}"
+ end
+ if my_module
+ task_m = "| #{I18n.t('search.index.module')}
+
+ #{my_module.name}"
+ end
notification = Notification.create(
type_of: notification_type,