Module: Synchronisable::Model::ClassMethods
- Defined in:
- lib/synchronisable/model.rb
Constant Summary collapse
- SYNCHRONIZER_SUFFIX =
'Synchronizer'
Instance Method Summary collapse
-
#synchronisable(*args) ⇒ Object
Declare this on your model class to make it synchronisable.
Instance Method Details
#synchronisable(klass, options) ⇒ Object #synchronisable(options) ⇒ Object #synchronisable ⇒ Object
Declare this on your model class to make it synchronisable. After that you can call Methods#sync to start model synchronization.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# 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' scope :without_import, -> { includes(:import) .where(imports: { synchronisable_id: nil }) .references(:imports) } set_defaults(args) end |