bonniecheung/OrdrInMapper — comment on commit 1186c1186f5e7f41d759f6126803b531acd744ed
File: app/controllers/locations_controller.rb line 41
By jduff:

With my suggestions in the Location model you can just do this:

``` ruby
@location = Location.find(params[:id])

gon.locations = @location.delivery_list # assuming gon can handle a hash.

# or

gon.location_names = @location.delivery_list.collect{|item| item[:name]}
gon.location_addresses = @location.delivery_list.collect{|item| item[:address]}
# If you need to do it this way I would have delivery_list build an array of Structs then you could do
# @location.delivery_list.collect(&:name)
```