The accused, from Co Sligo, is alleged to have attacked the woman because she was talking on the phone to a male friend.
She was later found by gardai at a neighbour's house in a blood-soaked dressing gown.
The woman's jaw and nose were broken and she had to spend a week in hospital.
The trial heard that the accused admitted hitting her but claimed she hit him first.
He has pleaded not guilty at the Central Criminal Court to rape with an implement and assault causing harm to the 45-year-old woman between November 17 and 18, 2011.
The woman had lived with the accused, but he was living elsewhere at the time.
The day before, he asked to stay in her house, saying that he had lost his keys. The next night the woman had just got out of the shower when he asked her if she wanted to have sex.
She said she replied "definitely no" and answered a phone call from a friend. The accused became very aggressive and called her a "witch".
She said he started pushing her and then hit her in the face. He continued to beat and kick her as she was on the ground.
The woman said he inserted a carrot in her, causing terrible bleeding. She said she lost consciousness for a short time before leaving for help.
A garda gave evidence that the woman's bathrobe was saturated with blood when he arrived and that he found blood stains throughout the house.
He said it looked as if someone had tried to clean the hallway. He also found what looked like a piece of carrot.
The woman told defence counsel Patrick Giblin that the accused had assaulted her on previous occasions. She said he had also beaten his former wife.
Mr Giblin put it to her that his client had never beaten his ex-wife. The accused denies any incident with a carrot and says it was she who attacked him.
She suffered her injuries when she hit her head on a radiator, Mr Giblin insisted.
The trial continues before Mr Justice Patrick McCarthy and a jury of eight women and four men.