Scales fit into the melody and harmony - since MELODIES can be played using step-wise, or scale-sounding intervals, so too can a scale be used to identify the KEY SIGNATURE. Identifying keys can relate more to HARMONY as do modes, major or minor, harmonic minor, etc…
Scales and Modes:
http://www.gmajormusictheory.org/Listening/scales/scales.html
Scale Degree Quiz (intervals identification in music excerpt context)
GREAT FOR TEST PREP!
http://www.gmajormusictheory.org/Listening/scaledegreegames/SDQuizzes/mp3/SD1B.mp3
Video Explaining Modes
https://www.youtube.com/watch?v=d_DxhbYwJDA
Major and Minor System, Dominant and Subdominant
http://www.musictheory.net/lessons/23
Tonic, Dominant, Subdominant
http://legacy.earlham.edu/~tobeyfo/musictheory/Book2/FFH2_CH6/6A_SecondaryDominants.html
Minors and Modes Cheat Sheet:
https://drive.google.com/open?id=1-8mCzIgUw1TcVVXETNs_DaoIso3ZyeYOBJ2s42mz1ww
Reddit has a Modes Thread with in-depth explanation:
https://www.reddit.com/r/musictheory/wiki/core/modes
Listen to Examples of Pop/rock tonality that draws on diatonic modes
http://openmusictheory.com/popRockHarmony-EverettSystem2.html