app/controllers/drinks_controller.rb
def create
    @drink = current_user.drinks.build(drink_params)

    if @drink.save
      render json: @drink, status: :created, location: @drink
    else
      render json: @drink.errors, status: :unprocessable_entity
    end
  end
# POST /drinks
# POST /drinks.json
# Only the user can make a drink
POST /drinks
POST /drinks.json
Only the user can make a drink
POST / drinks POST / drinks . json Only the user can make a drink
def create
    @drink = current_user.drinks.build(drink_params)
    if @drink.save
      render json: @drink, status: :created, location: @drink
    else
      render json: @drink.errors, status: :unprocessable_entity
    end
  end
def create @drink = current_user . drinks . build ( drink_params ) if @drink . save render json : @drink , status : :created , location : @drink else render json : @drink . errors , status : :unprocessable_entity end end
POST /drinks
POST /drinks.json
Only the user can make a drink
POST / drinks POST / drinks . json Only the user can make a drink