It doesn't have a rails server on the car. The car communicates to Teslas datacenter, which is where the Rails servers are. You then query the API by querying the datacenter.
I certainly hope the engineers their are staying on top of the recent deluge of Rails patches. Tesla's database has a huge amount of private data; mostly containing information about rich and influential people. A black hat could undoubtedly profit by tracking people and correlating their location to affairs/secret business meetings/etc.
According to Elon Musk, it only sends data if you explicitly enable it.
I'd just like to add that they enabled it by default for cars they lend to media outlets for reviews after the Top Gun thing. Some people in the other thread were freaking out about how much Tesla knows about your car but a regular customer can just opt out.