Module: HasRemote

Defined in:
lib/has_remote.rb,
lib/has_remote/railtie.rb,
lib/has_remote/synchronizable.rb,
lib/has_remote/synchronization.rb

Overview

The main module for the has_remote plugin. Please see README for more information.

Defined Under Namespace

Modules: ClassMethods, InstanceMethods, Synchronizable Classes: Config, Synchronization

Class Method Summary (collapse)

Class Method Details

+ (Object) models

Returns an array of all models that have a remote.



15
16
17
18
19
20
21
22
# File 'lib/has_remote.rb', line 15

def self.models
  # Make sure all models are loaded:
  if Rails.root
    Dir[Rails.root.join('app', 'models', '*.rb')].each { |f| require_dependency f }
  end

  @models ||= []
end

+ (Object) synchronize!

Updates cached attributes, destroys deleted records and adds new records of all models that have a remote. Also see Synchronizable.



27
28
29
# File 'lib/has_remote.rb', line 27

def self.synchronize!
  models.each(&:synchronize!)
end