Module: ActiveMerge

Extended by:
ActiveSupport::Autoload
Defined in:
lib/active_merge.rb,
lib/active_merge/service.rb,
lib/active_merge/version.rb,
lib/active_merge/simple_service.rb

Overview

Declares service object for merging ActiveRecord instances.

After extending your active record model with the module, new ::merge_all method is available.

Defined Under Namespace

Classes: Service, SimpleService

Constant Summary collapse

VERSION =
"1.0.5"

Instance Method Summary collapse

Instance Method Details

#merge_allObject

Merges instances from the association

class Lord < ActiveRecord::Base
  extend ActiveMerge
end

Lord.all.merge_all              # => merges all the class instances
Lord.where("id > :id", id: 100) # => merges instances with id > 100

See details in ActiveMerge::Service#provide documentation.


25
26
27
# File 'lib/active_merge.rb', line 25

def merge_all
  ActiveMerge::Service.new(all).provide
end