public
Fork of sam/dm-core
Description: DataMapper - Core
Homepage: http://datamapper.org
Clone URL: git://github.com/halorgium/dm-core.git
Raise a more meaningful exception

In a DM::Resource when an associated class is missing, it is non-obvious 
where it is
failing.
halorgium (author)
Wed Jul 23 20:40:33 -0700 2008
commit  982941177548461d8b91cfb788e266513844f48a
tree    4449dea182f89359b15269229a38c51ebd082b7a
parent  c27a67f6d960d2edd41cd8b6ae3bfee218293816
...
61
62
63
 
 
64
65
66
67
68
 
 
69
70
71
...
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
0
@@ -61,11 +61,15 @@ module DataMapper
0
       # @api private
0
       def parent_model
0
         Class === @parent_model ? @parent_model : (Class === @child_model ? @child_model.find_const(@parent_model) : Object.find_const(@parent_model))
0
+ rescue NameError
0
+ raise NameError, "Cannot find the parent_model #{@parent_model} for #{@child_model}"
0
       end
0
 
0
       # @api private
0
       def child_model
0
         Class === @child_model ? @child_model : (Class === @parent_model ? @parent_model.find_const(@child_model) : Object.find_const(@child_model))
0
+ rescue NameError
0
+ raise NameError, "Cannot find the child_model #{@child_model} for #{@parent_model}"
0
       end
0
 
0
       # @api private

Comments

    No one has commented yet.