README.md in active_report-1.0.0 vs README.md in active_report-1.1.0

- old
+ new

@@ -20,14 +20,18 @@ Or install it yourself as: $ gem install active_report -## Usage +## Table of Contents -### Array +* [Array](#array) +* [Hash](#hash) +* [Record](#record) +## Array + **Export:** Convert an array or array of arrays to a CSV. **Options:** * headers: column titles of CSV data * options: CSV options to be use on generation @@ -52,17 +56,17 @@ ```ruby ActiveReport::Array.import("sample.csv") ActiveReport::Array.import("sample.csv", headers: ["ID", "Task", "Completed"], options: { col_sep: ";" }) ``` -### Hash +## Hash **Export:** Convert a hash or an array of hashes to a CSV. **Options:** - * only: key/value pairs to be used on generation - * except: key/value pairs not to be used on generation + * only: keys of pairs to be used on generation + * except: keys of pairs not to be used on generation * headers: column titles of CSV data * options: CSV options to be use on generation ```ruby @list = [ @@ -76,21 +80,21 @@ ``` **Import:** Convert a CSV into an array of hashes. **Options:** - * only: key/value pairs to be used on generation - * except: key/value pairs not to be used on generation + * only: keys of pairs to be used on generation + * except: keys of pairs not to be used on generation * headers: column titles of CSV data **Required** * options: CSV options to be use on parsing ```ruby ActiveReport::Hash.import("sample.csv") ActiveReport::Hash.import("sample.csv", except: :completed, headers: ["ID", "Task"], options: { col_sep: ";" }) ``` -### Record +## Record **Export:** Convert an ActiveRecord/Relation object(s) to a CSV. **Options:** * only: columns to be used on generation @@ -105,9 +109,23 @@ <# ActiveRecord::Relation Object > ] ActiveReport::Record.export(@list) ActiveReport::Record.export(@list, only: [:id, :item], headers: ["ID", "Task"], options: { col_sep: ";" }) +``` + +**Import:** Create new database records from a CSV. + +**Options:** + * model: model of objects being generated + * only: keys of pairs to be used on generation + * except: keys of pairs not to be used on generation + * headers: column titles of CSV data **Required** + * options: CSV options to be use on parsing + +```ruby +ActiveReport::Record.import("sample.csv", User) +ActiveReport::Record.import("sample.csv", User, except: :completed, headers: ["ID", "Task"], options: { col_sep: ";" }) ``` ## Contributing 1. Fork it ( https://github.com/[my-github-username]/active_report/fork ) \ No newline at end of file