Here is how I learn scales.
I first memorise the pattern on the keyboard. I have my own personal memorisation system.
So the major key is a progression of Root, Tone, Tone, Semi-tone, Tone, Tone, Tone, Semi-Tone to bring you back to the octave.
So depending on what key you are in, you need to introduce sharps and flats to keep that same pattern in each key.
How to memorise what sharps and flats you need? Like this.....
I'll show it in the circle of fifths, as most are familiar with it but it's not necessary for learning these patterns. But don't let that stop you from learning it. It's helpful for remembering the order in which they appear. Its a system of lines and 'bumps' for showing where the shaprs and flats appear and also for nice grouping into two TTS TTTS groups.
C no sharps
G has an F sharp
_ _ _ _ _ _ /¯\ _
There you go. It's broken up into white keys and black keys. The scales can be broken down into these diagrams to remember the shape they make on the keyboard.
_ _ /¯\ _ _ _ /¯\_
and so on..........
c# f# g#
_ _ /¯\ _ _ /¯\ /¯\ _
f# g# c#d#
_ /¯\ /¯\ _ _ /¯\ /¯\ _
_ /¯\ /¯\ _ /¯\ /¯\ /¯\ _
So they are all the sharp keys starting on whites. I'll do another post on the flats and the ones starting on black keys. With this I have been easily able to commit to memory basically all major keys. If you forget you can pretty much work them out on the spot because they have these unique patterns that slot onto the keyboard quite nicely and fit the hand shape.