DEV Community

Cover image for Meet Your New Queens
JaredHarbison
JaredHarbison

Posted on • Updated on

Meet Your New Queens

Rails + React + Redux - Pt 4


This post is going to focus on some of the more challenging tasks I encountered while scraping data from Fandom then connecting the data appropriately into the schema established in the last post. In retrospect I would scrape seasons before queens, so I've accounted for the order here. This post will focus on defining the get_queens method and the get_seasons will follow. The gist is heavily commented!


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 post 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.

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

__see the next post for the gist__

That's all folks!

Top comments (0)