I also faced the same problem yesterday and I remember that for most applications, the bin folder serves as the starting point.
So, in this case, the bin/rails file is a script that serves as an entry point to run various Rails commands, such as starting the Rails server, generating database migrations, or running tests.
When you encountered the error /usr/bin/env: ‘ruby\r’: No such file or directory, the Linux environment didn’t recognize the Windows-style line ending in the bin/rails script.
To fix this issue, you can convert the line endings of the bin/rails file to Linux-style line endings (LF). If you’re using a Windows text editor, check its settings for an option to change line endings to Unix/Linux-style (LF). Alternatively, you can use a tool like dos2unix to convert the file. Once you’ve converted the line endings, you should be able to deploy your app on fly.io without encountering the error.
I used Notepad++ all I did is opened the bin/rails file with np++ and went into the Edit option I selected EOL conversion and chose the UNIX(LF).