Rake routes not showing the route, but it exists when hard code

I use Devise and Omniauth for my login process. For some reason, I can easily access the route "users / auth / facebook" or "users / auth / twitter". But they do not appear when I do rake routes, so I have no idea what help method for these paths is (for example, something_something_path). Can someone help me?

I cannot show all my routes, but I can say that the only route that matches "/ users / auth / ..." that appears is this (from rake routes):

 user_omniauth_callback        /users/auth/:action/callback(.:format)    {:action=>/(?!)/, :controller=>"users/omniauth_callbacks"}

By the way, when I say that β€œI can access the route just fine”, I mean that this works (redirects me correctly to facebook or twitter):

<%= link_to "Connect", "users/auth/facebook" %>

In addition, the routes must be the default Devise omniauth routes for the user model.

+5
source share
2 answers

Regarding why this is not displayed in rake routes, first pay attention to how the task is performed. It is part of the railties , and it gets routes to show like for example :

Rails.application.routes.routes

So, we see what he asks Rails.applicationfor his routes.


, Omniauth gem - , Rack.

Rack, Rails.application, rake routes, .

Rack Railcast.


, rake middleware, OmniAuth::Builder rails . , auth/twitter?

, request_path call, , , request_path (path_prefix auth , name - twitter.

Omniauth Devise, path_prefix , .

+4

, . , : https://github.com/plataformatec/devise/wiki/OmniAuth%3A-Overview

:

Devise . User omniauthable "devise_for: " config/routes.rb, Devise URL:

user_omniauth_authorize_path () user_omniauth_callback_path ()

, devise_for :model , url.

:

<%= link_to "Sign in with Facebook", user_omniauth_authorize_path(:facebook) %>

, devise, , URL:

https://github.com/plataformatec/devise/blob/master/lib/devise/omniauth/url_helpers.rb

0

All Articles