ぼざクリタグ広場 https://hub.nizika.monster
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.
 
 
 
 
 

26 lines
698 B

  1. class PostVersionRecorder
  2. def self.record! post:, event_type:, created_by_user:
  3. new(post:, event_type:, created_by_user:).record!
  4. end
  5. def initialize post:, event_type:, created_by_user:
  6. super(record: post, event_type:, created_by_user:)
  7. end
  8. private
  9. def version_class = PostVersion
  10. def version_association = :post_versions
  11. def record_key = :post
  12. def snapshot_attributes
  13. { title: @post.title,
  14. url: @post.url,
  15. thumbnail_base: @post.thumbnail_base,
  16. tags: @post.snapshot_tag_names.join(' '),
  17. parent: @post.parent,
  18. original_created_from: @post.original_created_from,
  19. original_created_before: @post.original_created_before }
  20. end
  21. end