Вопрос

Im trying to refresh the Geokit location to session after the user sign in. I have the following code.

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

But I'm getting the following error.

NoMethodError in Devise::SessionsController#create

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

Seems like Geokit is not loading before the devise controller. Any idea?

Это было полезно?

Решение

The problem is after_sign_in_path_for must return a valid an url object and you are not doing it check its documentation.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top