In this study, we investigated reconfigurable intelligent surface (RIS)-assisted device-to-device (D2D) communication systems over Nakagami-m fading channels. To enhance the reliability of RIS-assisted D2D communications, we utilized the rate-splitting multiple access (RSMA) technique to maximize the achievable ergodic rate for our considered systems. Specifically, both devices decoded the common symbol by treating private symbols as interference, and then each private symbol was decoded by treating the other as interference. In order to maximize the achievable ergodic rate at the destination, we analyzed the achievable ergodic rate of the RIS link and the D2D link, and the destination jointly decoded both symbols transmitted from the source and device by involving the maximum ratio combination (MRC). We obtained a closed-form expression for the achievable ergodic rate of the proposed RIS-assisted D2D communication system. Finally, we investigated the influence of power allocation factors and the number of reflective elements on the achievable ergodic rate. As seen by the numerical results, there was a good match between the analysis and simulation results, as well as significant superiority compared with existing works.