In this lesson, we are going to learn how to work with files in Ruby, including how to create, edit and append. This information can be particularly helpful when you want to store content on a text file, so that you don't have to rely on a database connection every time. It's good to have some practical knowledge on this.
Ruby does some cool things when it comes to reading from a file, and we are going to see it in this lesson.
Now that we know how to create a file and read from it, let's learn how to delete a file. It can be done with a single line of code.
In this lesson we are going to learn something that is very practical: appending information to the end of a file. Typically, you may want to append information to a log file from time to time, and we'll see how to do this now.
devCamp does not support ancient browsers.
Install a modern version for best experience.