Who entered the contract with the restaurant?
In order for the restaurant to collect from a person, that person must have entered into a contract for the meal. That is, from the restaurant's point of view, they must have indicated that they would like some food and, since everyone knows how restaurants work, they know that the food will have to be paid for.
Whether a given person entered a contract will depend on the specific facts. If they opened their mouth and said to the waiter something like “I’ll have the chicken”, they almost certainly entered a contract and they are obliged to pay. This is even if they had an expectation that someone else would pay for them - the restaurant is not involved in any other contracts or arrangements you might have with third-parties. You ordered, you’re on the hook.
In a situation where you didn’t order, the answer is still probably yes, you have to pay. Again, because you know how restaurants work, by eating the meal that was placed in front of you rather than saying, “Just so you know, your contract for this meal is with that guy over there, is that okay?”, you probably entered a contract by your action of eating the meal.
More broadly, when a group collectively enters a contract with the restaurant, they are probably agreeing with the restaurant that they will be jointly and severally bound. That is, each is responsible for all and the restaurant can pursue any or all of the people they have a contract with.
A minor dining with their parents is probably not entering a contract with the restaurant. Not because minors can’t enter contracts (they absolutely can) but because of the normal expectation that the parent is entering the contract.
This is because of a principle that contract terms may be implied by custom. That is, if there is a general understanding that this is the way things are done, then that will be something the law will enforce. This is a simple expedient adopted in order to make the world work - if every term of every contract had to be explicitly detailed in advance this would be a) unworkable and b) impossible.
Even if there is no contract, the restaurant has equitable remedies like unjust enrichment. The diner has had the benefit of the meal and it would be unjust if the restaurant was left out of pocket. Equitable remedies can be even more complicated than contract law so we’ll just leave it at that.
As for whether the restaurant will accept a promise from one diner that another will pay, that’s up to them.