设计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.