2012-04-25 44 views
0

我試圖在用戶登錄後刷新Geokit位置到會話。我有以下代碼。after_sign_in_path_for action not loading Rails中的Geokit

# app/controllers/application_controller.rb 
def after_sign_in_path_for(resource_or_scope) 
    session[:geo_location] = User.geocode(current_user.city) 
end 

但是我收到以下錯誤。

NoMethodError in Devise::SessionsController#create 

undefined method `model_name' for Geokit::GeoLoc:Class 

似乎像Geokit沒有加載之前的設計控制器。任何想法?

回答

1

問題是after_sign_in_path_for必須返回一個有效的url對象,並且你沒有這樣做檢查它的documentation