Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

In your Gemfile:

gem "move_associations"
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 © 2010 MonsterLabs. See LICENSE for details.

About

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

Resources

Stars

5 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages