迁移测试

This commit is contained in:
huang 2015-12-24 15:27:49 +08:00
parent 055fac5e27
commit 7d35931460
1 changed files with 16 additions and 0 deletions

16
lib/tasks/hjq_test.rake Normal file
View File

@ -0,0 +1,16 @@
namespace :hjq do
namespace :news do
desc "news order"
task :users => :environment do
a = []
news = News.where("course_id =?", 122)
news.each do |new|
unless new.comments.blank?
new = new.comments.sort! { |a,b| a.created_on <=> b.created_on}.last.commented
end
a << new
end
puts a.length
end
end
end