Firstly, it seems your passport is required to buy a train ticket at the station. If you use the link, your passport is required as part of the registration process.
A difficult one, it depends upon which service you choose e.g. travelling on the 12:47, you can only buy a ticket at the station. They go on sale one hour before departure.
The services I listed are bookable, but only 24 hours in advance using the link.
Services 171, 169 and 83 should be bookable if there are spaces on the train.
Services 37/45 and 31 are Special Expresses, and you will most likely be offered a Waiting List option. Talking to Richard Barrow (Thailand's self-proclaimed train expert), being put onto a waiting list rarely results in getting a train.
Of course, yes, you can just turn up at Ratchaburi Station (with your passport) and try to buy a ticket for the next available train.
If I was you, I'd be looking at booking 24 hours before using the link. However, there is the option of doing what I did earlier today, and book from Bangkok to Hua Hin (not a lot of extra money), but boarding at Ratchaburi - for the longer journey, you can book 7 days in advance.