This application is meant to track of the songs being played by a room full of karaoke singers as well as their drink tab.
run bundle install
Create your migrations.
-
KaraokeSinger
should have a name(string) and a number_of_drinks(integer) -
Song
should have a title(string), runtime_in_minutes(integer), and an artist_name(string) -
A
KaraokeSinger
can have many songs and aSong
can have many karaoke_singers. What is the relationship? What additional migration(s) will you need?
Column | Type |
---|---|
name | string |
number_of_drinks | integer |
Column | Type |
---|---|
title | string |
runtime_in_minutes | integer |
artist_name | string |
- What associations will this need?
- (i.e.
has_many
,has_many through
, andbelongs_to
)
Song#karaoke_singers
returns all the karaoke_singers who have sung that songSong.find_by_artist(artist_name)
returns all of the songs by a specified artist nameSong#number_of_times_sung
returns an integer based on the number of times that song has been sung by a KaraokeSinger
KaraokeSinger#songs
returns all the songs that singer has sungKaraokeSinger#sing(song)
takes in an instance of a Song and creates a join between the KaraokeSinger instance an the Song instanceKaraokeSinger#buy_drink
increases and saves the drink total for that karaoke_singer by oneKaraokeSinger#songs_by_artist(artist)
returns an array of unique artist names of every song that karaoke_singer has sungKaraokeSinger#drinks_tab(price_per_drink)
returns the number of drinks for a karaoke_singer and multiplies it by theprice_per_drink
argumentKaraokeSinger.total_tab(price_per_drink)
is a class method that adds together the tabs for every KaraokeSinger instance