0
使用來自地理編碼器的railscast 217(多步驟/嚮導)。我想要做的是讓用戶在表單的第一部分輸入會議位置,然後在表單的第二部分輸入geocoder返回地址解析器已過濾出的地址列表。我會如何去做這件事?導軌3多種形式的地理編碼器
我已經創建了多步表單。但是我在控制器中使用什麼來從表單的第一部分獲取地址(街道,城市,國家),然後使用geocoder的near屬性返回表單第二部分中的附近位置列表?
使用來自地理編碼器的railscast 217(多步驟/嚮導)。我想要做的是讓用戶在表單的第一部分輸入會議位置,然後在表單的第二部分輸入geocoder返回地址解析器已過濾出的地址列表。我會如何去做這件事?導軌3多種形式的地理編碼器
我已經創建了多步表單。但是我在控制器中使用什麼來從表單的第一部分獲取地址(街道,城市,國家),然後使用geocoder的near屬性返回表單第二部分中的附近位置列表?
想通了這一點:
首先找到其在railscast被計費
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)
「第二」 頁面