scinote-web/db/migrate/20151111135802_reset_assigned_samples_counters.rb

14 lines
344 B
Ruby
Raw Normal View History

2017-06-30 16:23:28 +08:00
class ResetAssignedSamplesCounters < ActiveRecord::Migration[4.2]
2016-02-12 23:52:43 +08:00
def change
if defined?(Sample)
Sample.find_each do |sample|
Sample.reset_counters(sample.id, :sample_my_modules)
end
2016-02-12 23:52:43 +08:00
MyModule.find_each do |my_module|
MyModule.reset_counters(my_module.id, :sample_my_modules)
end
2016-02-12 23:52:43 +08:00
end
end
end