From b08d851341dc3907f35a863a20a5f8f30af5cb04 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 26 Sep 2020 10:51:14 -0700 Subject: [PATCH] Store user id from access token --- app/controllers/api/v1/parties_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/parties_controller.rb b/app/controllers/api/v1/parties_controller.rb index 1107f13..169e248 100644 --- a/app/controllers/api/v1/parties_controller.rb +++ b/app/controllers/api/v1/parties_controller.rb @@ -6,7 +6,12 @@ class Api::V1::PartiesController < Api::V1::ApiController end def create - @party = Party.new(shortcode: random_string, user_id: party_params[:user_id]) + @party = Party.new(shortcode: random_string) + + if current_user + @party.user = current_user + end + render :show, status: :created if @party.save! end