迁移测试
This commit is contained in:
parent
055fac5e27
commit
7d35931460
|
@ -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
|
Loading…
Reference in New Issue