The Talmud attributes the writing of Megillat Ruth to Samuel the prophet. It is placed in the canon as a separate scroll despite its brevity, underlining its importance as a self-contained teaching.
סִידְרָן שֶׁל כְּתוּבִים: רוּת וְסֵפֶר תְּהִלִּים וְאִיּוֹב וּמִשְׁלֵי, קֹהֶלֶת, שִׁיר הַשִּׁירִים וְקִינוֹת, דָּנִיאֵל וּמְגִילַת אֶסְתֵּר, עֶזְרָא וְדִבְרֵי הַיָּמִים. וּלְמַאן דְּאָמַר: אִיּוֹב בִּימֵי מֹשֶׁה הָיָה, לַיקְדְּמֵיהּ לְאִיּוֹב בְּרֵישָׁא! אַתְחוֹלֵי בְּפוּרְעֲנוּתָא לָא מַתְחֲלִינַן. רוּת נָמֵי פּוּרְעָנוּת הִיא! פּוּרְעָנוּת דְּאִית לֵיהּ אַחֲרִית – דְּאָמַר רַבִּי יוֹחָנָן: לָמָּה נִקְרָא שְׁמָהּ רוּת? שֶׁיָּצָא מִמֶּנָּה דָּוִד, שֶׁרִיוָּהוּ לְהַקָּדוֹשׁ בָּרוּךְ הוּא בְּשִׁירוֹת וְתוּשְׁבָּחוֹת. וּמִי כְּתָבָן? מֹשֶׁה כָּתַב סִפְרוֹ וּפָרָשַׁת בִּלְעָם וְאִיּוֹב. יְהוֹשֻׁעַ כָּתַב סִפְרוֹ וּשְׁמוֹנָה פְּסוּקִים שֶׁבַּתּוֹרָה. שְׁמוּאֵל כָּתַב סִפְרוֹ וְשׁוֹפְטִים וְרוּת. דָּוִד כָּתַב סֵפֶר תְּהִלִּים – עַל יְדֵי עֲשָׂרָה זְקֵנִים: עַל יְדֵי אָדָם הָרִאשׁוֹן, עַל יְדֵי מַלְכִּי צֶדֶק, וְעַל יְדֵי אַבְרָהָם, וְעַל יְדֵי מֹשֶׁה, וְעַל יְדֵי הֵימָן, וְעַל יְדֵי יְדוּתוּן, וְעַל יְדֵי אָסָף,
The baraita continues: The order of the Writings is: Ruth and the book of Psalms, and Job and Proverbs; Ecclesiastes, Song of Songs, and Lamentations; Daniel and the Scroll of Esther; and Ezra and Chronicles. The Gemara asks: And according to the one who says that Job lived in the time of Moses, let the book of Job precede the others. The Gemara answers: We do not begin with suffering, i.e., it is inappropriate to start the Writings with a book that deals so extensively with suffering. The Gemara asks: But the book of Ruth, with which the Writings opens, is also about suffering, since it describes the tragedies that befell the family of Elimelech. The Gemara answers: This is suffering which has a future of hope and redemption. As Rabbi Yoḥanan says: Why was she named Ruth, spelled reish, vav, tav? Because there descended from her David who sated, a word with the root reish, vav, heh, the Holy One, Blessed be He, with songs and praises. The baraita now considers the authors of the biblical books: And who wrote the books of the Bible? Moses wrote his own book, i.e., the Torah, and the portion of Balaam in the Torah, and the book of Job. Joshua wrote his own book and eight verses in the Torah, which describe the death of Moses. Samuel wrote his own book, the book of Judges, and the book of Ruth. David wrote the book of Psalms by means of ten elders of previous generations, assembling a collection that included compositions of others along with his own. He included psalms authored by Adam the first man, by Melchizedek king of Salem, and by Abraham, and by Moses, and by Heman, and by Jeduthun, and by Asaph,