This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
ar_merge /
| name | age | message | |
|---|---|---|---|
| |
README.markdown | Sun Nov 22 00:29:23 -0800 2009 | |
| |
Rakefile | Sun Nov 22 00:29:23 -0800 2009 | |
| |
VERSION | Sun Dec 13 02:20:26 -0800 2009 | |
| |
ar_merge.gemspec | Sun Dec 13 02:20:29 -0800 2009 | |
| |
init.rb | Sun Dec 21 23:44:24 -0800 2008 | |
| |
lib/ | Sun Dec 13 02:17:36 -0800 2009 | |
| |
spec/ | Tue Nov 17 12:51:22 -0800 2009 |
README.markdown
- Merges associations/attributes you want
- Can merge duplicates
- Protects from self-merges
- Keeps counters valid
- Removes merged record
INSTALL
Rails plugin
script/plugin install git://github.com/grosser/ar_merge.git
OR Gem
sudo gem install ar_merge
USAGE
Merge from outside the model:
user.merge!(other,:attributes=>user.attributes.keys,:associations=>%w[movies friends])`
Merge from inside the model
User < ActiveRecord::Base
def merge!(other)
super(other,:attributes=>%w[email website])
end
end
Merge duplicates
#merge all new users, that have the same email
User.merge_duplicates!(User.find_all_by_status('new')) , :compare=>:email)
AUTHOR
Michael Grosser
grosser.michael@gmail.com
Hereby placed under public domain, do what you want, just do not hold me accountable...







