Create named routes for OmniAuth in Rails 3

前端 未结 3 1611
别跟我提以往
别跟我提以往 2021-02-05 22:04

After having watched Ryan\'s excellent Railcast Simple OmniAuth, I\'ve managed to implement authentication in my app.

Everything is working fine, but in my view I have l

3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-05 22:28

    With Rails 3 you can do :

    # routes.rb
    match '/signin/:provider/callback' => 'sessions#create', :as => :signing
    
    #view.erb
    <%= link_to 'twitter', signing_path(:provider => 'twitter') %>
    <%= link_to 'facebook', signing_path(:provider => 'facebook') %>
    

提交回复
热议问题