module Troo::RemoteModelHelpers::InstanceMethods

Public Instance Methods

local() click to toggle source

@return [Ohm::Model]

# File lib/troo/helpers/remote_model_helpers.rb, line 47
def local
  @local ||= local_model.by_external_id(id)
end
preprocess() click to toggle source

@return []

# File lib/troo/helpers/remote_model_helpers.rb, line 38
def preprocess
  associations.map do |association|
    associated(association).map { |record| record.preprocess }
  end

  Persistence::Local.persist(self)
end

Private Instance Methods

associated(association) click to toggle source
# File lib/troo/helpers/remote_model_helpers.rb, line 53
def associated(association)
  Array(send(association))
end