DEV Community

Cover image for That was quite an episode...
JaredHarbison
JaredHarbison

Posted on • Updated on

That was quite an episode...

Rails + React + Redux - Pt 5


This post is going to focus on creating an Appearance for each queen. I'll iterate through each Episode's contestants' ids to find_or_create_by the contestants' drag_names then create the Appearance using the Episode and Queen ids.


Let's get started!


1. Def get_seasons in season.rb to scrape the list of season names from Fandom, concatenate each season name into an array of URLS for each Season's Wikipedia page, then iterate through the array to .create!() an instance of each Season.

__see previous posts for the gist__

2. Def get_queens in queen.rb to scrape the list of queens' names from Fandom, concatenate each queen's name into an array of URLs for each Queen's Fandom page, then iterate through the array to .create!() an instance of each Queen and her attributes (including associations for Quotes and Trivia.

__see previous posts for the gist__

3. With Seasons and Queens instantiated, iterate through the Seasons and .create!() an appearance for each episode per Queen and her appropriate appearance attributes.

A subsequent post will include the last in the scraping segment of the project, where I'll gather the queens stats from each episode and store them with her appearance! Then I'll have enough data to start creating the user interface.


That's all folks!

Top comments (0)