Permalink
Browse files

Cleanup rdoc for import method

  • Loading branch information...
jkowens committed Sep 5, 2017
1 parent 31ed228 commit 3246575bb8fa8b8db0cd4e801bc55b78bc1d7ce7
Showing with 16 additions and 16 deletions.
  1. +16 −16 lib/activerecord-import/import.rb
@@ -214,18 +214,18 @@ def support_setting_primary_key_of_imported_objects?
#
# == Options
# * +validate+ - true|false, tells import whether or not to use
# ActiveRecord validations. Validations are enforced by default.
# ActiveRecord validations. Validations are enforced by default.
# * +ignore+ - true|false, an alias for on_duplicate_key_ignore.
# * +on_duplicate_key_ignore+ - true|false, tells import to discard
# records that contain duplicate keys. For Postgres 9.5+ it adds
# ON CONFLICT DO NOTHING, for MySQL it uses INSERT IGNORE, and for
# SQLite it uses INSERT OR IGNORE. Cannot be enabled on a
# recursive import. For database adapters that normally support
# setting primary keys on imported objects, this option prevents
# that from occurring.
# records that contain duplicate keys. For Postgres 9.5+ it adds
# ON CONFLICT DO NOTHING, for MySQL it uses INSERT IGNORE, and for
# SQLite it uses INSERT OR IGNORE. Cannot be enabled on a
# recursive import. For database adapters that normally support
# setting primary keys on imported objects, this option prevents
# that from occurring.
# * +on_duplicate_key_update+ - an Array or Hash, tells import to
# use MySQL's ON DUPLICATE KEY UPDATE or Postgres 9.5+ ON CONFLICT
# DO UPDATE ability. See On Duplicate Key Update below.
# use MySQL's ON DUPLICATE KEY UPDATE or Postgres 9.5+ ON CONFLICT
# DO UPDATE ability. See On Duplicate Key Update below.
# * +synchronize+ - an array of ActiveRecord instances for the model
# that you are currently importing data into. This synchronizes
# existing model instances in memory with updates from the import.
@@ -323,7 +323,7 @@ def support_setting_primary_key_of_imported_objects?
# conflicting constraint to be explicitly specified. Using this option
# allows you to specify a constraint other than the primary key.
#
# ====== :conflict_target
# ===== :conflict_target
#
# The :conflict_target attribute specifies the columns that make up the
# conflicting unique constraint and can be a single column or an array of
@@ -333,7 +333,7 @@ def support_setting_primary_key_of_imported_objects?
#
# BlogPost.import columns, values, on_duplicate_key_update: { conflict_target: [ :author_id, :slug ], columns: [ :date_modified ] }
#
# ====== :index_predicate
# ===== :index_predicate
#
# The :index_predicate attribute optionally specifies a WHERE condition
# on :conflict_target, which is required for matching against partial
@@ -342,15 +342,15 @@ def support_setting_primary_key_of_imported_objects?
#
# BlogPost.import columns, values, on_duplicate_key_update: { conflict_target: [ :author_id, :slug ], index_predicate: 'status <> 0', columns: [ :date_modified ] }
#
# ====== :constraint_name
# ===== :constraint_name
#
# The :constraint_name attribute explicitly identifies the conflicting
# unique index by name. Postgres documentation discourages using this method
# of identifying an index unless absolutely necessary. Below is an example:
#
# BlogPost.import columns, values, on_duplicate_key_update: { constraint_name: :blog_posts_pkey, columns: [ :date_modified ] }
#
# ====== :condition
# ===== :condition
#
# The :condition attribute optionally specifies a WHERE condition
# on :conflict_action. Only rows for which this expression returns true will be updated.
@@ -359,19 +359,19 @@ def support_setting_primary_key_of_imported_objects?
#
# BlogPost.import columns, values, on_duplicate_key_update: { conflict_target: [ :author_id ], condition: "blog_posts.title NOT LIKE '%sample%'", columns: [ :author_name ] }
#
# ====== :columns
# ===== :columns
#
# The :columns attribute can be either an Array or a Hash.
#
# ======== Using an Array
# ===== Using an Array
#
# The :columns attribute can be an array of column names. The column names
# are the only fields that are updated if a duplicate record is found.
# Below is an example:
#
# BlogPost.import columns, values, on_duplicate_key_update: { conflict_target: :slug, columns: [ :date_modified, :content, :author ] }
#
# ======== Using a Hash
# ===== Using a Hash
#
# The :columns option can be a hash of column names to model attribute name
# mappings. This gives you finer grained control over what fields are updated

0 comments on commit 3246575

Please sign in to comment.