设计Omniauth未定义方法omniauth_authorize_path [英] Devise Omniauth undefined method omniauth_authorize_path

查看:129
本文介绍了设计Omniauth未定义方法omniauth_authorize_path的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,登录到Devise时,我开始收到这些错误消息.

I've noticed that when logging to Devise I have started to receive these error message.

我正在将Devise 2.2.4与Omniauth 1.1.4和Omniauth-Facebook 1.4.1一起使用

I'm using Devise 2.2.4 with Omniauth 1.1.4 and Omniauth-Facebook 1.4.1

有人知道这个错误的原因吗?

Does anybody know what is the cause of this error?

  ActionView::Template::Error (undefined method `omniauth_authorize_path' for #<#<Class:0xb85e534>:0xb904e5c>):
21: <%- if devise_mapping.omniauthable? %>
22:   <%- resource_class.omniauth_providers.each do |provider| %>
23:     <% logger.info "hey #{provider} , dolphin and #{resource_name}" %>
24:     <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
25:   <% end -%>
26: <% end -%>

  app/views/devise/shared/_links.erb:24:in `block in _app_views_devise_shared__links_erb___1039642231_94147460'
  app/views/devise/shared/_links.erb:22:in `each'
  app/views/devise/shared/_links.erb:22:in `_app_views_devise_shared__links_erb___1039642231_94147460'
  app/views/devise/sessions/new.html.erb:17:in `_app_views_devise_sessions_new_html_erb__883448937_92868060'

推荐答案

一个可能的错误是omniauth配置设置在错误的位置.

One possible mistake is that omniauth configuration is set at the wrong place.

我遇到此错误是因为按照omniauth自述文件的指示,我在config/initializers/omniauth.rb中设置了我的Facebook帐户.

I encountered this error because I set my facebook accounts in config/initializers/omniauth.rb, as instructed by the omniauth readme.

但是,我们需要通过设计进行设置,即在omniauth部分的config/initializers/devise.rb.

However we need to set it through devise, i.e. config/initializers/devise.rb at the omniauth section.

这篇关于设计Omniauth未定义方法omniauth_authorize_path的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆