fix tab
This commit is contained in:
parent
9e54e1794c
commit
cc81f41a57
|
@ -2,13 +2,13 @@ namespace :personal_journal do
|
||||||
desc 'set_journal_type'
|
desc 'set_journal_type'
|
||||||
task :set_journal_type => :environment do |task,args|
|
task :set_journal_type => :environment do |task,args|
|
||||||
JournalPaper.where(:rss2_id.ne=>nil).update_all({"$unset"=>{"journal_type_ids"=>""}})
|
JournalPaper.where(:rss2_id.ne=>nil).update_all({"$unset"=>{"journal_type_ids"=>""}})
|
||||||
MemberTag.all.each do |mt|
|
MemberTag.all.each do |mt|
|
||||||
journal_type = JournalType.where(:title=>mt.title).first
|
journal_type = JournalType.where(:title=>mt.title).first
|
||||||
journal_type = JournalType.create(:title_translations=>mt.title_translations) if journal_type.nil?
|
journal_type = JournalType.create(:title_translations=>mt.title_translations) if journal_type.nil?
|
||||||
journal_type_id = journal_type.id
|
journal_type_id = journal_type.id
|
||||||
journal_paper_ids = JournalPaper.where(:member_profile_id.in=>mt.member_profile_ids, :rss2_id.ne=>nil).pluck(:id)
|
journal_paper_ids = JournalPaper.where(:member_profile_id.in=>mt.member_profile_ids, :rss2_id.ne=>nil).pluck(:id)
|
||||||
JournalPaper.where(:id.in=>journal_paper_ids).update_all({"$addToSet"=>{"journal_type_ids"=>journal_type.id}})
|
JournalPaper.where(:id.in=>journal_paper_ids).update_all({"$addToSet"=>{"journal_type_ids"=>journal_type.id}})
|
||||||
# JournalType.where(:id=>journal_type_id).update_all({"$addToSet"=>{"journal_paper_ids"=>{"$each"=>journal_paper_ids}}})
|
# JournalType.where(:id=>journal_type_id).update_all({"$addToSet"=>{"journal_paper_ids"=>{"$each"=>journal_paper_ids}}})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue