README.md in postgres-copy-1.2.0 vs README.md in postgres-copy-1.3.0

- old
+ new

@@ -30,21 +30,21 @@ class User < ActiveRecord::Base acts_as_copy_target end ``` -This will add the aditiontal class methods to your model: +This will add the additional class methods to your model: * copy_to * copy_to_string * copy_to_enumerator * copy_from ### Using copy_to and copy_to_string You can go to the rails console and try some cool things first. -The first and most basic use case, let's copy the enteire content of a database table to a CSV file on the database server disk. +The first and most basic use case, let's copy the entire content of a database table to a CSV file on the database server disk. Assuming we have a users table and a User AR model: ```ruby User.copy_to '/tmp/users.csv' ``` @@ -81,11 +81,11 @@ ```ruby puts User.copy_to_string ``` -Another insteresting feature of copy_to is that it uses the scoped relation, it means that you can use ARel +Another interesting feature of copy_to is that it uses the scoped relation, it means that you can use ARel operations to generate different CSV files according to your needs. Assuming we want to generate a file only with the names of users 1, 2 and 3: ```ruby User.select("name").where(:id => [1,2,3]).copy_to "/tmp/users.csv" @@ -142,10 +142,10 @@ User.copy_from "/tmp/users.csv" do |row| row[0] = "fixed string" end ``` -The above extample will always change the value of the first column to "fixed string" before storing it into the database. +The above example will always change the value of the first column to "fixed string" before storing it into the database. For each iteration of the block row receives an array with the same order as the columns in the CSV file. To specify NULL value you can pass the null option parameter.