Module: Synchronisable::Model::ClassMethods

Defined in:
lib/synchronisable/model.rb

Constant Summary collapse

SYNCHRONIZER_SUFFIX =
'Synchronizer'

Instance Method Summary collapse

Instance Method Details

#synchronisable(klass, options) ⇒ Object #synchronisable(options) ⇒ Object #synchronisableObject

Declare this on your model class to make it synchronisable. After that you can call Methods#sync to start model synchronization.

Examples:

Common usage

class FooModel < ActiveRecord::Base
  synchronisable BarSynchronizer
end

Overloads:

  • #synchronisable(klass, options) ⇒ Object

    Parameters:

    • klass (Class)

      synchronizer class to be used

    • options (Hash)

      describes behavior of synchronisable model

    Options Hash (options):

    • :synchronizer (Class)

      class that provides synchronization configuration

See Also:



30
31
32
33
34
35
36
37
# File 'lib/synchronisable/model.rb', line 30

def synchronisable(*args)
  extend Synchronisable::Model::Methods

  class_attribute :synchronizer
  has_one :import, as: :synchronisable, class_name: 'Synchronisable::Import'

  set_defaults(args)
end