CsvContentValidator
Ruby gem which will allow authors to validate the content of well-formed CSV files.
Installation
Add this line to your application's Gemfile:
gem 'csv_content_validator'
And then execute:
$ bundle
Or install it yourself as:
$ gem install csv_content_validator
Usage
require 'json'
require 'validators/recipients_validator.rb'
class RecipientsController < ApplicationController
def create
render validator.render_errors(params[:csv_file].tempfile)
end
def update
render validator.render_errors(params[:csv_file].tempfile, JSON.parse(params[:corrections]))
end
private
def validator
@validator ||= RecipientsValidator.new
end
end
Contributing
- Fork it ( https://github.com/[my-github-username]/csv_content_validator/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request