Q:

Undefined method "delete" on redirect_to

When I'm authenticating using the google-drive-ruby gem trying to redirect the user via the auth url returns the error
"undefined method 'delete' for #<Addressable::URI:0x0000000d8c1128>"
For reasons I'm not entirely aware of. Here's my code:
class UserFormsController < ApplicationController
  layout 'admin'
  before_action :set_user_form, only: [:show, :edit, :update, :destroy]
  before_action :g_auth_user

  # GET /user_forms
  def index
    @user_forms = UserForm.all
    redirect_to @auth_url
  end

[...]

  def g_auth_user
    credentials = Google::Auth::UserRefreshCredentials.new(
      client_id: "506139056270-iu34antv0ebbouo332p55gem8vj5uj9b.apps.googleusercontent.com",
      client_secret: "CNc0okSHqFBsmLSeZgzDhyHJ",
      scope: [
      "https://www.googleapis.com/auth/drive",
      "https://spreadsheets.google.com/feeds/",
      ],
      redirect_uri: user_forms_url)
    @auth_url = credentials.authorization_uri
  end

[...]

A:

It looks like the URI structure returned by that method is incompatible with redirec_to so you should be able to fix it by converting it to a string:
redirect_to @auth_url.to_s

