Sha256: 446871c9977a45ad2de54dd280ace848ff9188aaa450626a6f10d7d8dff7943b

Contents?: true

Size: 437 Bytes

Versions: 7

Compression:

Stored size: 437 Bytes

Contents

class ActiveRecord::Base

  def self.to_sync(scope_name, opts={}, &block)
    watch_list = if opts[:watch]
      [*opts.delete[:watch]]
    else
      [self]
    end
    if RUBY_ENGINE=='opal'
      watch_list.each do |klass_to_watch|
        ReactiveRecord::Base.sync_blocks[klass_to_watch][self][scope_name] << block
      end
    else
      # this is where we put server side watchers in place to sync all clients!
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
reactive-record-0.8.3 lib/reactive_record/reactive_scope.rb
reactive-record-0.8.2 lib/reactive_record/reactive_scope.rb
reactive-record-0.8.1 lib/reactive_record/reactive_scope.rb
reactive-record-0.7.43 lib/reactive_record/reactive_scope.rb
reactive-record-0.7.42 lib/reactive_record/reactive_scope.rb
reactive-record-0.7.41 lib/reactive_record/reactive_scope.rb
reactive-record-0.7.40 lib/reactive_record/reactive_scope.rb