Method: Pod4::Model#read

Defined in:
lib/pod4/model.rb

#readObject

Call this to fetch the data for this instance from the data source



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/pod4/model.rb', line 178

def read
  r = interface.read(@model_id)

  if r.empty?
    add_alert(:error, "Record ID '#@model_id' not found on the data source")
  else
    map_to_model(r)
    run_validation(:read)
    @model_status = :okay if @model_status == :unknown
  end

  self
rescue Pod4::WeakError
  add_alert(:error, $!)
  self
end