Exception: OccamsRecord::MissingDataError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/occams-record/errors.rb

Overview

Exception raised when a record wasn’t loaded with all requested data

Direct Known Subclasses

MissingColumnError, MissingEagerLoadError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record, name) ⇒ MissingDataError

Returns a new instance of MissingDataError.

Parameters:

  • record (OccamsRecord::Result::Row)
  • name (Symbol)


13
14
15
16
17
# File 'lib/occams-record/errors.rb', line 13

def initialize(record, name)
  @record, @name = record, name
  @model_name = record.class.model_name
  @load_trace = record.class.eager_loader_trace
end

Instance Attribute Details

#model_nameString (readonly)

Returns:

  • (String)


5
6
7
# File 'lib/occams-record/errors.rb', line 5

def model_name
  @model_name
end

#nameSymbol (readonly)

Returns:

  • (Symbol)


9
10
11
# File 'lib/occams-record/errors.rb', line 9

def name
  @name
end

#recordOccamsRecord::Result::Row (readonly)

Returns:

  • (OccamsRecord::Result::Row)


7
8
9
# File 'lib/occams-record/errors.rb', line 7

def record
  @record
end

Instance Method Details

#to_sString

Returns:

  • (String)


20
21
22
# File 'lib/occams-record/errors.rb', line 20

def to_s
  message
end