Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updating documentation for synchronizing unsaved/new instances with i…

…mport.

zdennis#16
  • Loading branch information...
commit 58b144b6bfef7376aef4efb21298d2ffa59a8333 1 parent 7958ed1
@zdennis zdennis authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/activerecord-import/import.rb
View
5 lib/activerecord-import/import.rb
@@ -129,6 +129,11 @@ def supports_on_duplicate_key_update?
# BlogPost.import posts, :synchronize=>[ post ]
# puts post.author_name # => 'yoda'
#
+ # # Example synchronizing unsaved/new instances in memory by using a uniqued imported field
+ # posts = [BlogPost.new(:title => "Foo"), BlogPost.new(:title => "Bar")]
+ # BlogPost.import posts, :synchronize => posts
+ # puts posts.first.new_record? # => false
+ #
# == On Duplicate Key Update (MySQL only)
#
# The :on_duplicate_key_update option can be either an Array or a Hash.
Please sign in to comment.
Something went wrong with that request. Please try again.