class LocationsController < ApplicationController before_action :set_location, only: [:show, :edit, :update, :destroy]
# GET /locations # GET /locations.json def index @location = Location.new end
# GET /locations/1 # GET /locations/1.json def show
end
# GET /locations/new def new
end
# POST /locations # POST /locations.json def create @client = GooglePlaces::Client.new('################')
@shops = @client.spots_by_query('coffee near #{@location(params[:address])}') @result = JSON.parse(@shops[1]) # @location.find_closest_shops(@location.params[:address]) end
private # Never trust parameters from the scary internet, only allow the white list through. def location_params params.require(:location).permit(:address) endend
<%= form_for @location do |f| %> <%= f.label :address %> <%= f.text_field :address, :placeholder => "City State" %> <br> <%= f.submit "Find Coffee!" %><% end %><%= print "#{@result['name']}" %>
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7099011d-e18c-4836-8bed-f68aad67cc6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
@shops = @client.spots_by_query('coffee near #{@location(params[:address])}')
@shops = @client.spots_by_query("coffee near #{location_params[:location][:address])}")
<%= print "#{@result['name']}" %>
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/C7D8086A-6B34-4002-8D67-A555010E2F33%40agileconsultingllc.com.
def create @shops = [] @client = GooglePlaces::Client.new('AIzaSyCC5Dyjn5_gGSKZMVJqF6tKOYOaxgUMJ8s') @shops = @client.spots_by_query('coffee near ' + @location.address) end