Permalink
Browse files

Updating documentation for synchronizing unsaved/new instances with i…

…mport.

zdennis#16
  • Loading branch information...
1 parent 7958ed1 commit 58b144b6bfef7376aef4efb21298d2ffa59a8333 @zdennis zdennis committed Apr 6, 2011
Showing with 5 additions and 0 deletions.
  1. +5 −0 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.

0 comments on commit 58b144b

Please sign in to comment.