You can not select more than 25 topics
Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- class Legacy
- def self.clear_period
- begin
- count = 0
- puts '---------------------'
-
- Course.transaction do
- Course.all.each do |course|
- if course.class_period =~ /^\D*$/
- count += 1
- puts "[#{course.id}]: #{course.name}"
- puts "period #{course.class_period} ===> 0"
- puts '---------------------'
- course.class_period = '0'
- course.save
- end
- end # each end
- end # transaction end
-
- puts "clean period count: #{count}"
- rescue Exception => ex
- puts "*** transaction abored!"
- puts "*** errors: #{ex.message}"
- end
- end
- end
|