You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

insert.rb 487B

123456789101112131415161718192021
  1. module Insert
  2. def self.post(post, db)
  3. db.from(:posts).insert(
  4. body: post[:body],
  5. created_at: post[:created_at],
  6. creator: post[:creator],
  7. thread_id: post[:thread_id],
  8. remote_id: post[:remote_id],
  9. )
  10. end
  11. def self.thread(thread, db)
  12. id = db.from(:threads).insert(
  13. title: thread[:title],
  14. creator: thread[:creator],
  15. remote_id: thread[:remote_id],
  16. created_at: thread[:created_at]
  17. )
  18. thread.merge(id: id)
  19. end
  20. end