我通过User
和omniauth-facebook
拥有自定义omniauth-vkontakte
模型和身份验证。需要进行身份验证才能将评论留给Post
模型并查看Book
模型。所以我定义了一个sessions_controller.rb
:
def create
user = User.from_omniauth(request.env['omniauth.auth'])
cookies[:user_id] = user.id
redirect_to root_path
end
以及show.html.erb
和Book
模型的Post
我都有以下内容:
<div>
<p>Only signed in users can leave comments/reviews.
Please sign in via <%= link_to 'Facebook', 'auth/facebook' %> or
<%= link_to 'VK', 'auth/vkontakte' %> </p>
</div>
在routes.rb
我有这个:
get 'auth/:provider/callback', to: 'sessions#create'
控制台返回以下错误:ActionController::RoutingError (No route matches [GET] "/books/auth/facebook")