As we know that in almost all web applications we need to amend such a functionality where you need to get the content from a file stored externally in your pc. lets say this content to be a simple text content.
In these cases what we can do is use the input output reader classes of ruby.
This way we can upload the file to the memory. Read its contents and then save the content to the database and discard the file.
lets take an example where we can create articles in a web application with its title and description.
Now lets say we have a text file in our system and we want all the text to be uploaded as article's description from that text file so we need to do this.
First of all lets see the view file for the same i.e views/articles/new.html.erb