我使用的是omniauth-facebook
gem與rails 3.2和devise 2.0。用omniauth-facebook將sign_in_and_redirect重定向到特定語言
我有一個網站有2種語言,英語和西班牙語。
http://localhost:3000/en 的http://本地主機:因爲在omniauth_callbacks_controller.rb重定向到http://localhost:3000/en
這是我omniauth_callbacks_controller 3000/ES
創業板工作正常英語用戶。 rb面向臉書:
def facebook
@user = User.find_for_facebook_oauth(request.env["omniauth.auth"], current_user)
if @user.persisted?
flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Facebook"
sign_in_and_redirect @user, :event => :authentication
else
session["devise.facebook_data"] = request.env["omniauth.auth"]
redirect_to new_user_registration_url
end
end
然後問題是西班牙用戶。如果他們使用http://localhost:3000/es
從回調重定向去http://localhost:3000/en
我想從回調重定向到使用該用戶的特定語言。
我該怎麼辦?
謝謝!
謝謝你的工作很好:D – hyperrjas 2012-05-19 11:05:52