I am new to Ruby on Rails.
I want to write a module for uploading a CSV file in my application. Also, I want to import the data from that file to one of my tables in my Rails application.
In my application there is a model named "Book" which has four fields: name
, author
, publication_date
and publisher_name
.
I want to give user the ability to upload a CSV file with the format:
- first column for
name
- second column for
author
- third for
publication_date
- fourth for
publisher_name
.
Also I want to add the validation so that upload will happen only when the file is of the expected format.