lib/tasks/xforum_tasks.rake in xforum-0.0.34 vs lib/tasks/xforum_tasks.rake in xforum-0.0.35
- old
+ new
@@ -23,9 +23,10 @@
end
def load_the_forum_file(file_name)
CSV.foreach(file_name, headers: true) { |row|
the_row=row.to_hash
+ puts "'row ' #{the_row['topic']} , #{the_row['content']}"
category_id=Xforum::Category.where(name:the_row['category']).pluck(:id)[0]
category_id=Xforum::Category.create(name:the_row['category']).id if category_id.nil?
topic_id=Xforum::Topic.where(name:the_row['topic']).pluck(:id)[0]
topic_id=Xforum::Topic.create(name:the_row['topic'],category_id:category_id).id if topic_id.nil?
the_row.delete('category')
\ No newline at end of file