Ruby on rails rails 4中未定义的模型方法
我正在尝试配置Google OAuth,但我面临一个无法解决的愚蠢错误: 单击主页上的登录按钮时:Ruby on rails rails 4中未定义的模型方法,ruby-on-rails,ruby,Ruby On Rails,Ruby,我正在尝试配置Google OAuth,但我面临一个无法解决的愚蠢错误: 单击主页上的登录按钮时: <% if user_signed_in? %> Signed in as <%= current_user.name %>. Not you? <%= link_to "Sign out", destroy_user_session_path,:method => :delete %> <% else %> <%= link
<% if user_signed_in? %>
Signed in as <%= current_user.name %>. Not you?
<%= link_to "Sign out", destroy_user_session_path,:method => :delete %>
<% else %>
<%= link_to "Sign in with Google", user_omniauth_authorize_path(:google_oauth2) %>
<% end %>
类中的def和end调用不匹配-def self.from_omniauthauth方法后缺少end。下一行的where缩进错误,将其隐藏。所以实际上,find_for_google_oauth2方法是在from_omniauth方法中定义的
这就是Ruby社区约定对双空间缩进策略非常严格的原因之一。你的问题是什么?我如何解决当我单击Google登录按钮以登录身份登录时出现的错误。不是你吗删除%>非常感谢,我为这个愚蠢的问题感到非常抱歉莎拉夫:没必要道歉-如果你不问,你就学不到: