title: Geocoder Gem - Ruby On Rails
body: <p>I just included the Geocoder gem into my app. Everything works perfect but i was wondering if i can user the gem even further. </p>
  
  <p>My application has got users and they are allowed to add articles. At the moment i can their IP address using </p>
  
  <pre><code> @article.ip_address = request.remote_ip
  </code></pre>
  
  <p>I have looked for a gem which can help me convert that IP address to country name but i can't find anything. Since i am using geocoder and i realize that on their website they auto detect my IP, City and Country. I was wondering how i can implement this to my controller. </p>
  
  <pre><code>def create
  @article = Breeder.new(params[:breeder])
  @article.user = current_user
  @article.ip_address = request.remote_ip
  
  respond_to do |format|
    if @article.save
      format.html { redirect_to @article, notice: 'Article was successfully created.' }
      format.json { render json: @article, status: :created, location: @article }
    else
      format.html { render action: "new" }
      format.json { render json: @article.errors, status: :unprocessable_entity }
    end
  end
  </code></pre>
  
  <p>end</p>
  
  <p>The idea is to detect articles which are not from the UK.</p>
  
  <p><a href="https://github.com/alexreisner/geocoder" rel="nofollow">https://github.com/alexreisner/geocoder</a></p>
  
  <p><a href="http://www.rubygeocoder.com/" rel="nofollow">http://www.rubygeocoder.com/</a></p>