Sha256: 8f0510eea4ddd4b5783bb641611e4e90944cbe068c54a4ae926e2991717e2d87
Contents?: true
Size: 1.77 KB
Versions: 3
Compression:
Stored size: 1.77 KB
Contents
= ActiveMerge {<img src="https://badge.fury.io/rb/active_merge.png" alt="Gem Version" />}[http://badge.fury.io/rb/active_merge] {<img src="https://travis-ci.org/nepalez/active_merge.svg" alt="Build Status" />}[https://travis-ci.org/nepalez/active_merge] {<img src="https://codeclimate.com/github/nepalez/active_merge.png" />}[https://codeclimate.com/github/nepalez/active_merge] {<img src="https://gemnasium.com/nepalez/active_merge.svg" alt="Dependency Status" />}[https://gemnasium.com/nepalez/active_merge] {<img src="https://coveralls.io/repos/nepalez/active_merge/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/nepalez/active_merge] Declares the <tt>ActiveMerge</tt> module for extending ActiveRecord models. == Main usage The module contains the <tt>merge_all</tt> class method for merging class instances into the first one. When merging a list of instances: * all "has_many" relatives are reattached to the instance with the lowest id * all the instances except for the first one (with the lowest id) are deleted === Example class Post < ActiveRecord extend ActiveMerge has_many :comments end Post.all.merge_all # This will merge all the posts into the first one. # The other posts will be deleted after their comment are reattached # to the first post. == Skipping validations and callbacks You can use the <tt>validate: false</tt> option. With this option set any activerecord validation and callback are skipped. Post.all.merge_all validate: false **Warning** Only activerecord validations and callbacks are skipped! Raising other errors (by database etc.) will cause all changes to roll back as before. == Version changes See the CHANGELOG[link:CHANGELOG.rdoc]. == License This project rocks and uses MIT LICENSE[link:LICENSE].
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
active_merge-1.2.1 | README.rdoc |
active_merge-1.2.0 | README.rdoc |
active_merge-1.1.0 | README.rdoc |