0.02
No commit activity in last 3 years
No release in over 3 years
Simply and securely merge AciveRecord`s.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme
  • Merges associations/attributes you want
  • Can merge duplicates
  • Protects from self-merges
  • Keeps counters valid
  • Removes merged record

INSTALL

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
michael@grosser.it
Build Status
License: MIT