From e6011882b45ab788830d0b8e5f36e070770ffaca Mon Sep 17 00:00:00 2001 From: Matthew Bender Date: Sat, 17 Jan 2015 14:33:03 -0700 Subject: [PATCH] replace deprecated user.team -> user.membership.team - also force the user to be logged in to create a new team --- app/controllers/teams_controller.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/teams_controller.rb b/app/controllers/teams_controller.rb index 27500c10..eb2df391 100644 --- a/app/controllers/teams_controller.rb +++ b/app/controllers/teams_controller.rb @@ -1,6 +1,6 @@ class TeamsController < ApplicationController skip_before_action :require_registration, :only => [:accept, :record_exit] - before_action :access_required, :except => [:index, :show, :new, :upgrade, :inquiry, :search, :create, :record_exit] + before_action :access_required, :except => [:index, :show, :new, :inquiry, :search, :create, :record_exit] before_action :ensure_analytics_access, :only => [:visitors] respond_to :js, :only => [:search, :create, :approve_join, :deny_join] respond_to :json, :only => [:search] @@ -150,9 +150,8 @@ def follow def upgrade upgrade_params = params.permit(:discount) - current_user.seen(:product_description) if signed_in? - @team = (current_user && current_user.team) || Team.new - store_location! unless signed_in? + current_user.seen(:product_description) + @team = current_user.membership.try(:team) || Team.new if upgrade_params[:discount] == ENV['DISCOUNT_TOKEN'] session[:discount] = ENV['DISCOUNT_TOKEN']