123456789101112131415161718192021 |
- module Insert
- def self.post(post, db)
- db.from(:posts).insert(
- body: post[:body],
- created_at: post[:created_at],
- creator: post[:creator],
- thread_id: post[:thread_id],
- remote_id: post[:remote_id],
- )
- end
-
- def self.thread(thread, db)
- id = db.from(:threads).insert(
- title: thread[:title],
- creator: thread[:creator],
- remote_id: thread[:remote_id],
- created_at: thread[:created_at]
- )
- thread.merge(id: id)
- end
- end
|