class MR::Factory::NoRecordClassError
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)
Public Class Methods
for_association(ar_association)
click to toggle source
# 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 message = "can't build '#{association_name}' association on " \ "#{owner_record_class}" if ar_association.reflection.options[:polymorphic] foreign_type_attribute = ar_association.reflection.foreign_type message += " -- try manually setting it, building it via a stack " \ "if you've configured default associations, or setting " \ "its '#{foreign_type_attribute}' attribute" else message += " -- try manually setting it or building it via a stack " \ "if you've configured default associations" end self.new(message) end