# Controllers not being loaded

**URL:** <https://www.ruby-forum.com/t/controllers-not-being-loaded/79450>\
**Category:** Engines\
**Created:** [December 15, 2006, 9:36am UTC](https://www.ruby-forum.com/t/controllers-not-being-loaded/79450 "2006-12-15T09:36:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Nelson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@James\_Nelson](https://www.ruby-forum.com/u/James_Nelson)\
**Post date:** [December 15, 2006, 9:36am UTC](https://www.ruby-forum.com/t/controllers-not-being-loaded/79450/1 "2006-12-15T09:36:17Z")

</div>

I was having a bit of trouble on the latest edge rails with my  
controllers  
not being loaded, so I made a few changes to engines.rb in the engines  
plugin directory. Basically, on the last three references to $LOAD\_PATH,  
I  
added a line afterwards doing exactly the same thing with  
Dependencies.load\_paths:

# add these LAST on the load path.

```
  load_paths.reverse.each { |dir|
    if File.directory?(dir)
      Engines.log.debug "adding #{File.expand_path(dir)} to the load

```

path"  
#$LOAD\_PATH.push(File.expand\_path(dir))  
$LOAD\_PATH.push dir  
Dependencies.load\_paths.push dir  
end  
}

```
  # Add the other engines back onto the bottom of the $LOAD_PATH. 

```

Put  
them back on in  
# the same order.  
$LOAD\_PATH.push(\*old\_plugin\_paths)  
Dependencies.load\_paths.push(\*old\_plugin\_paths)  
$LOAD\_PATH.uniq!  
Dependencies.load\_paths.uniq!

I’m sure this is utterly awful code, but it was just a quick fix to get  
it  
working, since I don’t know if the problem was with engines, rails or  
me.  
I’m not sure whether I was doing something wrong in the first place to  
make  
it so my controllers could not be found. I do know that the Dependencies  
module in active support didn’t have the app directory for my engine in  
its  
load path (the one I found by actually tracing the application’s  
execution),  
but by the same token, it _was_ in the application’s load path earlier  
in  
execution. The really weird things is the libs and models for my engine  
_were_ loading fine when the controllers weren’t.

Also, I can’t tell if it was working previously and changed with an  
update  
to the latest rails, as I only just added the controllers to my  
application.

---

<div class="post-metadata">

**Author:** ![James\_Nelson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@James\_Nelson](https://www.ruby-forum.com/u/James_Nelson)\
**Post date:** [December 15, 2006, 10:48am UTC](https://www.ruby-forum.com/t/controllers-not-being-loaded/79450/2 "2006-12-15T10:48:28Z")

</div>

Hi James,

Can you check which versions of Rails/Ruby/Engines plugin you’re  
using? If you can also give a listing of your load paths (i.e. the  
output of “puts $LOAD\_PATH”, “puts Dependencies.load\_paths” and “puts  
ActionController::Routing.controller\_paths”), it would help me track  
down what the issue might be.

- James

---

<div class="post-metadata">

**Author:** ![James\_Nelson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@James\_Nelson](https://www.ruby-forum.com/u/James_Nelson)\
**Post date:** [December 15, 2006, 3:34pm UTC](https://www.ruby-forum.com/t/controllers-not-being-loaded/79450/3 "2006-12-15T15:34:53Z")

</div>

Ruby is 1.8.4  
Engines is at revision 489 (its the latest one in svn at the time of  
writing)  
Rails is at 5719 (again latest one in svn at time of writing)

> > puts $LOAD\_PATH  
> > ./script/…/config/…/config/…/vendor/rails/actionwebservice/lib/action\_web\_service/vendor/  
> > ./script/…/config/…/config/…/vendor/rails/actionmailer/lib/action\_mailer/vendor/  
> > ./script/…/config/…/config/…/vendor/rails/actionpack/lib/action\_view/helpers/…/…/action\_controller/vendor/html-scanner  
> > ./script/…/config/…/config/…/vendor/rails/actionpack/lib/action\_view/vendor  
> > ./script/…/config/…/config/…/vendor/rails/actionpack/lib  
> > ./script/…/config/…/config/…/vendor/rails/activerecord/lib/…/…/activesupport/lib/active\_support/vendor  
> > ./script/…/config/…/config/…/vendor/rails/activerecord/lib/…/…/activesupport/lib  
> > ./script/…/config/…/config/…/vendor/rails/activerecord/lib  
> > script/…/config/…/config/…/test/mocks/development  
> > script/…/config/…/config/…/app/controllers/  
> > script/…/config/…/config/…/app  
> > script/…/config/…/config/…/app/models  
> > script/…/config/…/config/…/app/controllers  
> > script/…/config/…/config/…/app/helpers  
> > script/…/config/…/config/…/components  
> > script/…/config/…/config/…/config  
> > script/…/config/…/config/…/lib  
> > script/…/config/…/config/…/vendor/plugins/numbat\_rbac/lib  
> > script/…/config/…/config/…/vendor/plugins/redhillonrails\_core/lib  
> > script/…/config/…/config/…/vendor/plugins/foreign\_key\_migrations/lib  
> > script/…/config/…/config/…/vendor/plugins/engines/lib  
> > script/…/config/…/config/…/vendor  
> > script/…/config/…/config/…/vendor/plugins/numbat\_rbac/lib/  
> > script/…/config/…/config/…/vendor/plugins/engines/lib/  
> > script/…/config/…/config/…/vendor/plugins/foreign\_key\_migrations/lib/  
> > script/…/config/…/config/…/vendor/plugins/redhillonrails\_core/lib/  
> > /var/www/getadrafter.dyndns.org/trunk/vendor/rails/railties/builtin/rails\_info/  
> > script/…/config/…/config/…/vendor/rails/railties  
> > script/…/config/…/config/…/vendor/rails/railties/lib  
> > script/…/config/…/config/…/vendor/rails/actionpack/lib  
> > script/…/config/…/config/…/vendor/rails/activesupport/lib  
> > script/…/config/…/config/…/vendor/rails/activerecord/lib  
> > script/…/config/…/config/…/vendor/rails/actionmailer/lib  
> > script/…/config/…/config/…/vendor/rails/actionwebservice/lib  
> > /usr/local/lib/site\_ruby/1.8  
> > /usr/local/lib/site\_ruby/1.8/x86\_64-linux  
> > /usr/local/lib/site\_ruby  
> > /usr/lib/ruby/1.8  
> > /usr/lib/ruby/1.8/x86\_64-linux  
> > .  
> > script/…/config/…/config/…/vendor/plugins/numbat\_rbac/app/models  
> > script/…/config/…/config/…/vendor/plugins/numbat\_rbac/app/helpers  
> > script/…/config/…/config/…/vendor/plugins/numbat\_rbac/app/controllers  
> > =\> nil

> > puts Dependencies.load\_paths  
> > script/…/config/…/config/…/test/mocks/development  
> > script/…/config/…/config/…/app/controllers/  
> > script/…/config/…/config/…/app  
> > script/…/config/…/config/…/app/models  
> > script/…/config/…/config/…/app/controllers  
> > script/…/config/…/config/…/app/helpers  
> > script/…/config/…/config/…/components  
> > script/…/config/…/config/…/config  
> > script/…/config/…/config/…/lib  
> > script/…/config/…/config/…/vendor  
> > script/…/config/…/config/…/vendor/plugins/numbat\_rbac/lib/  
> > script/…/config/…/config/…/vendor/plugins/engines/lib/  
> > script/…/config/…/config/…/vendor/plugins/foreign\_key\_migrations/lib/  
> > script/…/config/…/config/…/vendor/plugins/redhillonrails\_core/lib/  
> > /var/www/getadrafter.dyndns.org/trunk/vendor/rails/railties/builtin/rails\_info/  
> > script/…/config/…/config/…/vendor/plugins/numbat\_rbac/lib  
> > script/…/config/…/config/…/vendor/plugins/numbat\_rbac/app/models  
> > script/…/config/…/config/…/vendor/plugins/numbat\_rbac/app/helpers  
> > script/…/config/…/config/…/vendor/plugins/numbat\_rbac/app/controllers  
> > =\> nil

> > puts ActionController::Routing.controller\_paths  
> > script/…/config/…/config/…/app/controllers  
> > script/…/config/…/config/…/components  
> > /var/www/getadrafter.dyndns.org/trunk/vendor/rails/railties/builtin/rails\_info/  
> > script/…/config/…/config/…/vendor/plugins/numbat\_rbac/app/controllers  
> > script/…/config/…/config/…/vendor/plugins/numbat\_rbac/components  
> > =\> nil

Bear in mind, thats all after the modifications I made. With the changes  
commented out, Dependencies.load\_paths looks like this:

> > puts Dependencies.load\_paths  
> > script/…/config/…/config/…/test/mocks/development  
> > script/…/config/…/config/…/app/controllers/  
> > script/…/config/…/config/…/app  
> > script/…/config/…/config/…/app/models  
> > script/…/config/…/config/…/app/controllers  
> > script/…/config/…/config/…/app/helpers  
> > script/…/config/…/config/…/components  
> > script/…/config/…/config/…/config  
> > script/…/config/…/config/…/lib  
> > script/…/config/…/config/…/vendor  
> > script/…/config/…/config/…/vendor/plugins/numbat\_rbac/lib/  
> > script/…/config/…/config/…/vendor/plugins/engines/lib/  
> > script/…/config/…/config/…/vendor/plugins/foreign\_key\_migrations/lib/  
> > script/…/config/…/config/…/vendor/plugins/redhillonrails\_core/lib/  
> > /var/www/getadrafter.dyndns.org/trunk/vendor/rails/railties/builtin/rails\_info/  
> > =\> nil

---

<div class="post-metadata">

**Author:** ![James\_Nelson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@James\_Nelson](https://www.ruby-forum.com/u/James_Nelson)\
**Post date:** [December 15, 2006, 3:38pm UTC](https://www.ruby-forum.com/t/controllers-not-being-loaded/79450/4 "2006-12-15T15:38:55Z")

</div>

Hi again James,

With the SVN revisions, you also need to give the path (i.e. is it  
trunk or a branch or tag…); also, could you send all the load paths  
_without_ your change. You may also wish to enable the engines logger  
(see the README, section “Engines.log”). That’ll help us track down  
what the problem is.

- James

---

<div class="post-metadata">

**Author:** ![James\_Nelson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@James\_Nelson](https://www.ruby-forum.com/u/James_Nelson)\
**Post date:** [December 15, 2006, 3:53pm UTC](https://www.ruby-forum.com/t/controllers-not-being-loaded/79450/5 "2006-12-15T15:53:02Z")

</div>

I can tell you immediately that you will have problems using the  
current _public_ release of the engines plugin with the _trunk_  
version of Rails; they’re not compatible, as was discussed earlier on  
this list.

Instead, please use the 1.2 release branch of the engines plugin, and  
pay special attention to documentation regarding edge rails:

[http://svn.rails-engines.org/engines/branches/rb\_1.2](http://svn.rails-engines.org/engines/branches/rb_1.2)

HTH,

James

---

<div class="post-metadata">

**Author:** ![James\_Nelson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@James\_Nelson](https://www.ruby-forum.com/u/James_Nelson)\
**Post date:** [December 16, 2006, 1:54am UTC](https://www.ruby-forum.com/t/controllers-not-being-loaded/79450/6 "2006-12-16T01:54:55Z")

</div>

Oh, sorry about that, I only signed up for this list a day or two ago so  
I  
probably didn’t see it. Thanks for the help, and it all works now 🙂

---

<div class="post-metadata">

**Author:** ![James\_Nelson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@James\_Nelson](https://www.ruby-forum.com/u/James_Nelson)\
**Post date:** [December 15, 2006, 3:46pm UTC](https://www.ruby-forum.com/t/controllers-not-being-loaded/79450/7 "2006-12-15T15:46:59Z")

</div>

The bottom set of load paths is for Dependencies.load\_paths without the  
change. For ActionController::Routing.controller\_paths and $LOAD\_PATH,  
they  
are identical with and without the changes I made.

Engines svn is [http://svn.rails-engines.org/plugins/engines](http://svn.rails-engines.org/plugins/engines),  
Rails svn is [http://dev.rubyonrails.org/svn/rails/trunk](http://dev.rubyonrails.org/svn/rails/trunk)
