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

encoding: utf-8

Defined Under Namespace

Classes: Service, SimpleService

Constant Summary collapse

VERSION =
"1.2.1"

Instance Method Summary collapse

Instance Method Details

#merge_all(options = {}) ⇒ Object

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

You can use the validate: false option.

With this option set any activerecord validation and callback are skipped.

Post.all.merge_all validate: false

See details in ActiveMerge::Service#provide documentation.



31
32
33
# File 'lib/active_merge.rb', line 31

def merge_all(options = {})
  ActiveMerge::Service.new(all).provide(options)
end