httpリクエストからIPアドレスを取得する機能を備えたジオコーダーgemを使用しています。ドキュメントから:
Geocoder adds a +location+ method to the standard <tt>Rack::Request</tt> object so you can easily look up the location of any HTTP request by IP address. For example, in a Rails controller or a Sinatra app:
# returns Geocoder::Result object
result = request.location
置いた
@result = request.location
私のコントローラーでそして私の見解で
<%= @result %>
しかし、私はこれを手に入れました。
#<Geocoder::Result::Freegeoip:0x00000102dc7758>
それから私は試しました
<%= @result.to_s %>
しかし、それは何も変わりませんでした。
何か案は?