Skip to content

Instantly share code, notes, and snippets.

@jsqu99
Created April 25, 2013 00:37
Show Gist options
  • Save jsqu99/5456704 to your computer and use it in GitHub Desktop.
Save jsqu99/5456704 to your computer and use it in GitHub Desktop.
locations = CampLocation.unscoped.where("name like '%ustin%'")
location_option_values = []
locations.each do |location|
begin
location_option_values << Spree::OptionValue.unscoped.find(location.location_option_value_id)
rescue => error
puts "trouble with location: #{location.id} - #{location.name} - #{error}"
end
end
catch :finished do
Spree::Product.unscoped.all.each do |product|
product.option_values.each do |pov|
location_option_values.each do |lov|
if pov == lov
puts "\n\n\n MATCH for product: #{product.name} on #{lov.id} \n\n\n"
throw :finished
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment