Module: Remotable::ActiveRecordExtender

Extended by:
ActiveSupport::Concern
Includes:
Nosync
Defined in:
lib/remotable/active_record_extender.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from Nosync

#nosync, #nosync!, #nosync=

Instance Method Details

#any_remote_changes?Boolean

Returns:

  • (Boolean)


338
339
340
# File 'lib/remotable/active_record_extender.rb', line 338

def any_remote_changes?
  (changed.map(&:to_sym) & local_attribute_names).any?
end

#expired!Object



322
323
324
# File 'lib/remotable/active_record_extender.rb', line 322

def expired!
  update_attribute(:expires_at, 1.day.ago)
end

#expired?Boolean

Returns:

  • (Boolean)


318
319
320
# File 'lib/remotable/active_record_extender.rb', line 318

def expired?
  expires_at.nil? || expires_at < Time.now
end

#nosync?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/remotable/active_record_extender.rb', line 11

def nosync?
  self.class.nosync? || super
end

#pull_remote_data!Object



328
329
330
# File 'lib/remotable/active_record_extender.rb', line 328

def pull_remote_data!
  merge_remote_data!(remote_resource)
end

#remote_resourceObject



334
335
336
# File 'lib/remotable/active_record_extender.rb', line 334

def remote_resource
  @remote_resource ||= fetch_remote_resource
end