Once at the castle gates, Ralph is already there.
Moment of confusion
Ralph mentions a secret entrance:
There should be a hidden entrance in the palace garden! I'll sneak in through there!
After, Ralph explicitly says:
What? "Why do I know about the hidden passage on my first trip here?" Nevermind!!! I'm coming, Nayru!!!
How did Ralph know about this secret passage? It doesn't seem to be explained in-game. Is there any background to this?