lib/joiner/path.rb in joiner-0.1.0 vs lib/joiner/path.rb in joiner-0.2.0
- old
+ new
@@ -23,10 +23,14 @@
def reflections
klass = base
path.collect { |reference|
klass.reflect_on_association(reference).tap { |reflection|
- return [] if reflection.nil?
+ if reflection.nil?
+ raise Joiner::AssociationNotFound,
+ "No association matching #{base.name}, #{path.join(', ')}"
+ end
+
klass = reflection.klass
}
}
end
end