Class: RailsAdminMap::ServicesController

Inherits:
RailsAdmin::ApplicationController
  • Object
show all
Defined in:
app/controllers/rails_admin_map/services_controller.rb

Instance Method Summary collapse

Instance Method Details

#geocodeObject



4
5
6
7
8
9
10
# File 'app/controllers/rails_admin_map/services_controller.rb', line 4

def geocode()
  require 'net/http'
  url = "https://maps.googleapis.com/maps/api/geocode/json?key=#{Rails.application.config.geo_api_key}&address=#{params[:address]}"

  response = Net::HTTP.get_response(URI.parse(url))
  render json: response.body
end