0

I have a Model called file.rb that handles a files data table. This was done so that I can upload excel files from a file index.html.erb, and have the file name stored, see who uploaded the file, when it was created, etc(just tracking the files). These Excel files have many rows and each row have a bottle object with many attributes. During the create method, after save, I send the uploaded file to another model `bottle.rb'.

The bottle.rb model handles opening the Excel file and importing the information from the Excel file into the bottles data table.

I would like to be able to create an audit log with a message telling me success or failure of an uploaded excel file. Once the file passes the validations, I would like to see how many updates and new inserts to the bottles table. And be able to see this in the view where I upload the Excel file. I appreciate any helpful tips! I made an activity feed but for the entire application, but I am unsure how to go about to do this task.

  • Here is a guide to loging in rails: http://guides.rubyonrails.org/debugging_rails_applications.html#what-is-the-logger-questionmark You could just create a new audit.log file to write to. Another thing you might want to consider is renaming your file model. File is a class in ruby's standard library. –  Aug 07 '15 at 05:12
  • @jphager2 Thanks for the advise. As I was reading the loging in rails, but as I understand, that way of doing that, it writes it to a log. What I am trying to do is create a history log that people can see in the view right after they imported an excel file. I would like the history log to show how many rows where either updated or added. Thanks for the help and I'll be sure to rename the model. – Raymond Ruiz-Veve Aug 12 '15 at 01:39

0 Answers0