0

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?

Martin
  • 11,216
  • 23
  • 83
  • 140

1 Answers1

1

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

Andión
  • 1,103
  • 15
  • 26