Created
January 22, 2025 17:57
-
-
Save sbatson5/8f1e18e816cad1f7869b088e4b0a2681 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run | |
genres_array = fetch_genres_from_openai | |
return if genres_array.blank? | |
book.genres.clear | |
genres_array.each do |genre_name| | |
genre = Genre.find_by(name: genre_name) | |
puts "adding genre #{genre_name} to document profile #{book.id}" | |
book.genres << genre if genre.present? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment