Do it like that
<%- if devise_mapping.omniauthable? %> <%- resource_class.omniauth_providers.each do |provider| %> <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", public_send("user_#{provider.to_s}_omniauth_authorize_path") %><br /> <% end -%> <% end -%>
This allows you to use it for multiple providers, but assumes that you are using
devise_for :users
But even further you can also add
resource_class.name.downcase
to reach not only the user
<%- if devise_mapping.omniauthable? %> <%- resource_class.omniauth_providers.each do |provider| %> <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", public_send("#{resource_class.name.downcase}_#{provider.to_s}_omniauth_authorize_path") %><br /> <% end -%> <% end -%>
If devise_for is a user and provider, then it will create a path:
user_facebook_omniauth_authorize_path
if devise_for is the twitter admin and provider, then it will do the path:
admin_twitter_omniauth_authorize_path
source share