Last active
September 10, 2015 04:16
-
-
Save milushov/0e0d075b5e06801f3e75 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
file = "#{Rails.root}/public/data_wheel_msk_actual.csv" | |
wi = WheelItem.includes(:wheel, :brand).joins(store_items: :store).where('quantity > 0').where(stores: {city_id: 1}).uniq; nil; | |
CSV.open( file, 'w' ) do |writer| | |
wi.each do |s| | |
path = app.catalog_wheel_wheel_item_path(s.brand,s.model,s.article.downcase) | |
writer << [s.article, "http://www.kamtex.ru#{path}", "http://www.kamtex.ru#{s.wheel.image.url}"] | |
end | |
end | |
require 'csv' | |
file = "#{Rails.root}/public/data_wheel_spb_actual.csv" | |
wi = WheelItem.includes(:wheel, :brand).joins(store_items: :store).where('quantity > 0').where(stores: {city_id: 2}).uniq; nil; | |
CSV.open( file, 'w' ) do |writer| | |
wi.each do |s| | |
path = app.catalog_wheel_wheel_item_path(s.brand,s.model,s.article.downcase) | |
writer << [s.article, "http://piter.kamtex.ru#{path}", "http://piter.kamtex.ru#{s.wheel.image.url}"] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment