Using Rails 3.2. Previously I did this to destroy, but now I don't wanna destroy, but just mark them as inactive instead:
Shop.find_by_sql("SELECT id FROM #{ActiveRecord::Base.connection_config[:database]}.shops AS shops
LEFT OUTER JOIN thirdparty.othershoplist AS other_shops
ON shops.other_shop_id = other_shops.ShopID
WHERE other_shops.ShopID IS NULL").map(&:destroy)
Now I don't want to destroy the records, but wanna set the column for shop.shop_status as inactive for the return set.
Shop.find_by_sql("SELECT id FROM #{ActiveRecord::Base.connection_config[:database]}.shops AS shops
LEFT OUTER JOIN thirdparty.othershoplist AS other_shops
ON shops.other_shop_id = other_shops.ShopID
WHERE other_shops.ShopID IS NULL").update_all(shop_status: 'inactive')
But this is not working because the return set is an array. How can I achieve this as simple as possible (perhaps a one liner)?
SQLquery?