你好,我已經包括以下在我的Gemfile寶石地理編碼寶石創建問題
寶石「地理編碼器」
在我看來,寫入文件的下面的代碼
- @location = Geocoder.search(request.remote_ip).first.country
%div{"class" => "currentCountry", "value" => "#{@location}"}
- if session[:browser] == 'mobile'
testmobile
- else
testdesktop
和在Heroku服務器,它給了我錯誤,而在我的本地服務器工作正常。
ActionView::Template::Error (undefined method `country' for nil:NilClass):
2016-02-16T07:47:14.447459+00:00 app[web.1]:
2016-02-16T07:47:14.447455+00:00 app[web.1]: 3: - if session[:browser] == 'mobile'
2016-02-16T07:47:14.447456+00:00 app[web.1]: 4: = render 'mobile'
2016-02-16T07:47:14.447457+00:00 app[web.1]: app/views/spree/checkout/edit.html.haml:1:in `_b6865a451d7a5a040f6c1f6376727300'
2016-02-16T07:47:14.447458+00:00 app[web.1]:
2016-02-16T07:47:14.447454+00:00 app[web.1]: 1: - @location = Geocoder.search(request.remote_ip).first.country
2016-02-16T07:47:14.447454+00:00 app[web.1]: 2: %div{"class" => "currentCountry", "value" => "#{@location}"}
請指導爲什麼我在heroku服務器中遇到此錯誤。