我想访问在主范围内的 slave1 范围内定义的变量。如何正确确定变量的范围,使其在从块中设置并在主块中可用?
Octopus.using(:slave1) do
locations_with_wrong_country_code_ids = Location.where(country: "USA").ids
end
Octopus.using(:master) do
Location.where(id: locations_with_wrong_country_code_ids).each do |location|
location.country = "US"
location.save
end
end