There's at least a happy ending. One month after Glee alum Naya Rivera was arrested on domestic battery charges in relation to a physical altercation between her and her estranged husband Ryan Dorsey, the couple was able to finally come to a custody agreement over their two-year-old son Josey.

According to court documents obtained by The Blast, the couple agreed on a temporary joint custody of their child, and Ryan agreed to consult with Naya “on all major decisions related to the child’s health, education, and welfare.” The current agreement is only temporary because the couple is still working out the details of their long-term custody arrangement.

View this post on Instagram


A post shared by Naya Rivera (@nayarivera) on

"The family is working together peacefully and all matters have been amicably resolved," a representative for Naya revealed to E! News.

Naya had originally asked for joint legal and physical custody of the child in her second divorce filing from Ryan, which she submitted just two weeks after the incident with Ryan. Over Thanksgiving weekend, Ryan called local law enforcement after he accused his wife of hitting him and causing injury to his head and bottom lip. She was arrested and charged with domestic battery.

But according to The Blast, it seems like Ryan is ready to forgive his estranged wife for the sake their son. In their custody agreement, he agreed “not to pursue any criminal action” against Naya in relation to the “December 2017 incident."

Naya and Ryan have a history of having a volatile relationship. The couple started dating in 2010, but broke up, then got back together in 2014 and tied the knot, but Naya would eventually file for divorce for the first time in 2016. The Thanksgiving weekend incident took place just one month after Naya publicly called off their divorce. "She is back together with Ryan Dorsey," a source revealed to E! News at the time. "They want to make it work for the sake of their son."