# Model loading test and different load\_paths orders

**URL:** <https://www.ruby-forum.com/t/model-loading-test-and-different-load-paths-orders/122567>\
**Category:** Engines Development\
**Created:** [December 9, 2007, 3:59pm UTC](https://www.ruby-forum.com/t/model-loading-test-and-different-load-paths-orders/122567 "2007-12-09T15:59:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sven\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5e925/32.png) [@Sven\_F](https://www.ruby-forum.com/u/Sven_F)\
**Post date:** [December 9, 2007, 3:59pm UTC](https://www.ruby-forum.com/t/model-loading-test-and-different-load-paths-orders/122567/1 "2007-12-09T15:59:44Z")

</div>

I think that I’ve found the problem that causes the last test in  
model\_and\_lib\_test.rb to fail.

[http://svn.rails-engines.org/test/engines/rails\_2.0/test/unit/model\_and\_lib\_test.rb](http://svn.rails-engines.org/test/engines/rails_2.0/test/unit/model_and_lib_test.rb)

The problem is: with two models Something present in two plugins  
plugin\_a and plugin\_b the one in the latter plugin one should, but the  
former one actually is loaded.

This only happens when one uses Dependency constant autoloading for  
loading the class (as I did in the test). It doesn’t happen when one  
explicitely requires the file. This is because the plugin paths are  
inserted into $LOAD\_PATHS in reverse alphabetical order but appended  
to Dependencies.load\_paths in alphabetical order.

This behaviour seems to have around since at least Rails 1.2.x

I’ve also posted to the rails-core list:  
[http://www.ruby-forum.com/topic/134529](http://www.ruby-forum.com/topic/134529)

–  
sven fuchs removed\_email\_address@domain.invalid  
artweb design [http://www.artweb-design.de](http://www.artweb-design.de)  
grünberger 65 + 49 (0) 30 - 47 98 69 96 (phone)  
d-10245 berlin + 49 (0) 171 - 35 20 38 4 (mobile)
