the following query return as follow:
@cref = Creference.all
@cref = @cref.group_by{|cc| cc["name"]}
result: Object {US: Array[1], UK: Array[1]}
And these query return the result as:
@countries = Product.joins(:user).distinct.where("state is not null and country <> ''").where(:users => {:merchant_status => 1}).pluck(:country)
@countries.map! {|country| country.split.map(&:capitalize).join(' ')}
@countries = @countries.uniq
result: ["US", "UK"]
I am using gon to pass the result to the country drop down list:
gon.search_location_list = @countries + @cref
How can I make the first result format to match the second one? Thanks!!!
@countries + @cref.keys