Module: Nsync::ActiveRecord::ClassMethods

Defined in:
lib/nsync/active_record/methods.rb

Instance Method Summary collapse

Instance Method Details

#nsync_consumer(opts = {}) ⇒ Object

Makes this class an Nsync Consumer



8
9
10
11
# File 'lib/nsync/active_record/methods.rb', line 8

def nsync_consumer(opts={})
  self.nsync_opts = {:id_key => :source_id}.merge(opts)
  include Nsync::ActiveRecord::Consumer::InstanceMethods
end

#nsync_optsObject



24
25
26
27
# File 'lib/nsync/active_record/methods.rb', line 24

def nsync_opts
  return @nsync_opts unless superclass && superclass.respond_to?(:nsync_opts)
  @nsync_opts ||= superclass.nsync_opts.clone
end

#nsync_opts=(hash_of_options) ⇒ Object



20
21
22
# File 'lib/nsync/active_record/methods.rb', line 20

def nsync_opts=(hash_of_options)
  @nsync_opts = hash_of_options
end

#nsync_producer(opts = {}) ⇒ Object



13
14
15
16
17
18
# File 'lib/nsync/active_record/methods.rb', line 13

def nsync_producer(opts={})
  self.nsync_opts = {:id_key => :id}.merge(opts)
  include Nsync::ActiveRecord::Consumer::InstanceMethods
  include Nsync::Producer::InstanceMethods
  include Nsync::ActiveRecord::Producer::InstanceMethods
end