After having soaked the beans overnight or for at least 8 hours, place the beans in a large pot and cover with 6 cups of water. Add the bay leaves and the garlic cloves.
Bring the beans to a boil over high heat and then reduce the heat to medium-low, keeping the beans at a simmer for an hour and a half, stirring frequently.
Once the time is up, turn the heat off and set the beans aside. Leave them in the water with the lid on.
Set a large pot of water to boil for your pasta. While you wait for the water to boil, prepare the rest of the sauce by heating the olive oil in a large, wide saucepan.
Once the oil is hot, lower the heat to medium and add the onion and celery, stirring often. Be sure not to burn the mixture. Cook until the onion and celery have softened. This should take between 15 and 20 minutes.
Drain the beans and add them to the mixture. Discard the bay leaves but add the garlic cloves to the mixture as well. Mash the cloves up so that they flavour the sauce. Add the red pepper flakes and salt to taste. Cook for 5 minutes and then turn the heat off while you cook your pasta.
Once the water for the pasta has boiled, cook the pasta according to the package directions. Once the pasta is cooked, drain it and add it to the bean mixture. Turn the heat on low as you combine the pasta with the sauce. Add the parsley (optional) and serve immediately.