Module: Foobara::DetachedEntity::Concerns::Attributes
Instance Method Summary
collapse
Methods included from Concern
foobara_class_methods_module_for, foobara_concern?, included
Instance Method Details
#can_read_attributes_other_than_primary_key? ⇒ Boolean
22
23
24
|
# File 'foobara-0.0.125/projects/detached_entity/src/concerns/attributes.rb', line 22
def can_read_attributes_other_than_primary_key?
loaded?
end
|
#read_attribute(attribute_name) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'foobara-0.0.125/projects/detached_entity/src/concerns/attributes.rb', line 9
def read_attribute(attribute_name)
attribute_name = attribute_name.to_sym
if attribute_name != self.class.primary_key_attribute
unless can_read_attributes_other_than_primary_key?
raise CannotReadAttributeOnUnloadedRecordError,
"Cannot read attribute #{attribute_name} on unloaded record"
end
end
super
end
|