This file contains 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
ActiveRecord::Base.transaction do | |
Category.all.each do |c| | |
ordered_configs = c.search_attribute_configs. | |
joins(:search_attribute). | |
order("cnet_search_attributes.name"). | |
select("DISTINCT search_attribute_configs.id, cnet_search_attributes.name") | |
ordered_configs.each_with_index do |sa_config, index| | |
sa_config = SearchAttribute::Config.find(sa_config.id) | |
sa_config.update_attribute(:position, index + 1) |
This file contains 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
application@rommulus:~/projects/heute_kaufen/production/current$ RAILS_ENV=production bundle exec rake "cnet:update[false]" --trace | |
** Invoke cnet:update (first_time) | |
** Invoke cnet:config/application.yml (first_time) | |
** Execute cnet:config/application.yml | |
** Invoke environment (first_time) | |
** Execute environment | |
** Execute cnet:update | |
Downloading CNet data to /home/application/projects/heute_kaufen/production/current/tmp | |
rake aborted! | |
undefined method `log' for #<Rails::Paths::Root:0x00000005652a20> |
This file contains 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
Image.all.each do |img| | |
begin | |
img.file.recreate_versions! | |
rescue | |
puts "Cannot recreate version for Image with ID: #{img.id}" | |
end | |
end |
This file contains 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
#!/usr/bin/env ruby | |
require 'benchmark' | |
REGEXPS = [ | |
/^no such file to load -- (.+)$/i, | |
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, | |
/^Missing API definition file in (.+)$/i, | |
/^cannot load such file -- (.+)$/i, | |
] |
This file contains 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
rake 0.400000 0.030000 0.430000 ( 0.422317) | |
gem-patching 0.010000 0.000000 0.010000 ( 0.009515) | |
simple_form 0.020000 0.000000 0.020000 ( 0.030241) | |
kronn-has_many_polymo 0.010000 0.010000 0.020000 ( 0.014797) | |
i18n-missing_translat 0.030000 0.000000 0.030000 ( 0.021213) | |
test-unit 0.000000 0.000000 0.000000 ( 0.000027) | |
devise 0.400000 0.030000 0.430000 ( 0.444638) | |
delocalize 0.060000 0.010000 0.070000 ( 0.060652) | |
activeadmin 2.860000 0.290000 3.150000 ( 3.165178) | |
meta_search 0.000000 0.000000 0.000000 ( 0.001347) |
This file contains 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
begin | |
$counter = 0 | |
def update_positions(scope, start) | |
scope.each_with_index do |ia, index| | |
ia.update_attribute(:position, start + index) | |
$counter += 1 | |
end | |
end | |
Product.all.each do |p| | |
ia = p.image_assignments.where("position IS NOT NULL").order("position DESC").first |
This file contains 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
$affected = [] | |
$not_updated = [] | |
def update_timestamp(invoice, created_at) | |
if created_at.blank? | |
$not_updated << invoice | |
else | |
created_at = created_at.in_time_zone - 30.minutes | |
puts "#{invoice.id} #{invoice.created_at} -> #{created_at}" |
NewerOlder