Ok so this is simple 101 but I am obviously doing something wrong. Can you advise how I create a params array like the below.
params = []
params[:geo_bounding_box][:top_left_lat] = @search.ne_lat
params[:geo_bounding_box][:top_left_lon] = @search.sw_lon
params[:geo_bounding_box][:bottom_right_lat] = @search.sw_lat
params[:geo_bounding_box][:bottom_right_lon] = @search.ne_lon
Hope you can advise!
Ruby hashes (not arrays) are initialised with {}
not []
.
params = {}
params[:geo_bounding_box][:top_left_lat] = @search.ne_lat
...
Apart from that you're on the right track!
That's a Hash .
params = {
:geo_bounding_box => {
:top_left_lat => @search.ne_lat,
:top_left_lon => @search.sw_lon,
:bottom_right_lat => @search.sw_lat,
:bottom_right_lon => @search.me_lon
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.