It’s simpler to run two machines. With enough ram, you could set up some other web server in front of your two rails apps. You can find threads here about running Discourse and other things on the same host.
My point was with two machines x.example.com and example.com one doesn’t need to configure Nginx (or caddy) as a front door to deal with directing traffic to the correct site. Discourse just gets by on a 1GB droplet, so you’d probably want to bump to a 2GB droplet, so there’s no fiscal advantage to having a single droplet, and the simplicity of not configuring two Rails apps and another web server is probably good advice to someone who’s not sure.
BUT if you’re talking about how to set up a dev box, where you don’t care if you’re accessing localhost:3000 and localhost:3001, then that’s a different question. You can just use the same local dev setup and set the port of one of the apps like this: