Skip to content

Instantly share code, notes, and snippets.

@whdzera
Created May 20, 2025 18:45
Show Gist options
  • Save whdzera/b99aa5c9d2d779a52ae4e2fc9b132e99 to your computer and use it in GitHub Desktop.
Save whdzera/b99aa5c9d2d779a52ae4e2fc9b132e99 to your computer and use it in GitHub Desktop.
increase chapter in kitsumanga
# rails console
one_piece = Manga.find_by(title: "One Piece")
(1..1129).each do |n|
Chapter.create!(
manga_id: one_piece.id,
chapter_number: n,
images: "[]"
)
end
@whdzera
Copy link
Author

whdzera commented Jun 17, 2025

update v 2.0 reusable code

def seed_chapters(title, chapter_count)
  manga = Manga.find_by(title: title)

  (1..chapter_count).each do |n|
    Chapter.create!(
      manga_id: manga.id,
      chapter_number: n,
      images: "https://files.catbox.moe/qr9dw2.png"
    )
  end
end

seed_chapters("One Piece", 1129)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment