No commit activity in last 3 years
No release in over 3 years
This gem extends ActiveRecord to move associated records based on has_many and has_one associations.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

MoveAssociations¶ ↑

This gem extends ActiveRecord to move associated records based on has_many and has_one associations.

Getting started¶ ↑

In your Gemfile:

gem "move_associations"

Example usage¶ ↑

class City
  validates_presence_of :name
  belongs_to :state
  has_many :addresses
  has_one  :person
  has_many :institutions
end

@city = City.find(10)
@city.move_association(:addresses, 15) => # It move the associated records in addresses table from city with ID 10 to city with ID 15.

@city = City.find(10)
@city.move_associations(15)            => # It moves all the associated records from city with ID 10 to city with ID 15 using the 
                                          # has_many and has_one relationships.

Copyright¶ ↑

Copyright © 2010 MonsterLabs. See LICENSE for details.