From e579043622c5454ab94ec11e3bbf83bd65e0247d Mon Sep 17 00:00:00 2001 From: ifournight Date: Mon, 10 Apr 2017 15:30:50 +0800 Subject: [PATCH] Fix the bug that activities#index will crash when no current team --- app/controllers/activities_controller.rb | 1 + app/views/activities/index.html.erb | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index 8a609e0..6fc322d 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -1,5 +1,6 @@ class ActivitiesController < ApplicationController def index + @activities = [] if Team.exists?(session[:team_id]) @team = Team.find session[:team_id] projects = current_user.anticipated_projects_in_team(@team) diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb index 803abf8..3c3cd88 100644 --- a/app/views/activities/index.html.erb +++ b/app/views/activities/index.html.erb @@ -1,5 +1,6 @@ -<%= content_tag :section, class: 'section', id: "activities-team_#{@team.id}" do %> - <% if @activities.any? %> +<% if @activities.any? %> + <%= content_tag :section, class: 'section', id: "activities-team_#{@team.id}" do %> + <% @by_day_groups.each do |by_day_group| %>