Rails拒绝确认页面

时间:2017-03-24 07:42:42

标签: ruby-on-rails ruby

我的智慧在这里结束了。我花了几个小时顽固地试图说服Rails在localhost:3000/user_forms/redir存在一个页面,绝对没有用。当我尝试rake routes - 作为

时,会显示该页面

user_forms_redir GET /user_forms/redir(.:format) user_forms#redir 它肯定在routes.rb文件中:

Rails.application.routes.draw do
  get "user_forms/redir", to: "user_forms#redir"

因此/views/user_forms/redir.html.haml存在一个文件:

%h1 Checking Google Auth, please wait...

%p
  If this page continually hangs, please contact
  = mail_to "ex@ex.co.uk"

我甚至在user_forms_controller.rb文件中都有代码:

  def g_check_auth
    if(@authorization_code.nil?)
      redirect_to user_forms_redir_url
    end
  end

  # GET /user_forms/redir
  def redir
    @user_form = UserForm.new(set_user_form)

    credentials = Google::Auth::UserRefreshCredentials.new(
      client_id: "xxx",
      client_secret: "xxx",
      scope: [
      "https://www.googleapis.com/auth/drive",
      "https://spreadsheets.google.com/feeds/",
      ],
      redirect_uri: user_form_url(@user_form))
    @auth_url = credentials.authorization_uri
    redirect_to @auth_url.to_s
  end

该程序甚至可以将user_forms_redir_url作为有效路径!然而,在遵循这条道路后,我收到了一条可爱的404信息。请发送帮助

谢谢!

0 个答案:

没有答案