I'm new to rubyonrails. I need to collect foreach element as below array format
[
[lat1, long1],
[lat2, long2],
[lat3, long3],
[lat4, long4]
]
my code is
@outlet.each do |outlets|
lat = outlets.latitude
long = outlets.longitude
end
i can collect lat,long every loop. How can i format those element in above format?
pluckto just fetched the attributes from the database, e.g.Outlets.where(...).pluck(:latitude, :longitude)