Module: MR::FakeRecord::Attributes::InstanceMethods
- Defined in:
- lib/mr/fake_record/attributes.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#attributes ⇒ Object
ActiveRecord methods.
- #attributes=(new_attributes) ⇒ Object
- #column_for_attribute(name) ⇒ Object
Instance Attribute Details
#saved_attributes ⇒ Object
36 37 38 |
# File 'lib/mr/fake_record/attributes.rb', line 36 def saved_attributes @saved_attributes ||= {} end |
Instance Method Details
#attributes ⇒ Object
ActiveRecord methods
42 43 44 |
# File 'lib/mr/fake_record/attributes.rb', line 42 def attributes self.class.attributes.read_all(self) end |
#attributes=(new_attributes) ⇒ Object
46 47 48 49 |
# File 'lib/mr/fake_record/attributes.rb', line 46 def attributes=(new_attributes) return unless new_attributes.is_a?(Hash) self.class.attributes.batch_write(new_attributes, self) end |
#column_for_attribute(name) ⇒ Object
51 52 53 54 55 |
# File 'lib/mr/fake_record/attributes.rb', line 51 def column_for_attribute(name) self.class.attributes.find(name) rescue NoAttributeError return nil end |