0

Using railscast 217 (multistep/wizard) from and geocoder. What I want to do is have the user enter a meeting location on the first part of the form, then on the second part of the form have geocoder return a list of addresses that geocoder has filtered out. How would I go about doing this?

I've created the multistep form already. but what do I use in the controller to grab the address(street, city, country) from the first part of the form and then using the geocoder's near attribute to return a list of nearby locations in the second part of the form?

1 Answers1

0

Figured this out:

First find the "second" page which in the railscast is billing

elsif @order.currentplan_step == 'billing' (I placed this right after the first elsif)
   #now just build a location from the previous page(form) fields
   @orderlocation = params[:order][:orderaddress] + ", " + params[:order][:ordercity]

   #and create a list of addresses, now you can use @findlocations to create a list of addresses you can ship to that are near your location
   @findlocations = Location.near(@orderlocation, 20)