Exception: MR::Factory::NoRecordClassError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- MR::Factory::NoRecordClassError
- Defined in:
- lib/mr/factory.rb
Overview
used by factories and stacks to say they can’t determine a record class for an association (usually a polymorphic association doesn’t have its foreign type attribute set)
Class Method Summary collapse
Class Method Details
.for_association(ar_association) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/mr/factory.rb', line 60 def self.for_association(ar_association) owner_record_class = ar_association.owner.class association_name = ar_association.reflection.name = "can't build '#{association_name}' association on " \ "#{owner_record_class}" if ar_association.reflection.[:polymorphic] foreign_type_attribute = ar_association.reflection.foreign_type += " -- try manually setting it, building it via a stack " \ "if you've configured default associations, or setting " \ "its '#{foreign_type_attribute}' attribute" else += " -- try manually setting it or building it via a stack " \ "if you've configured default associations" end self.new() end |