Weird Extension stuff on Deployment

I developed a Radiant app with extensions, works great on my local box.

I deployed to TextDrive and now I’m having an issue.

  • Login fine
  • admin/pages shows fine
  • First time hitting my extensions link the page renders fine
  • Second time hitting my extensions like BAM!
    Application error

This is the stack trace:

NameError (uninitialized constant Admin::EventsController):
/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:266:in
load_missing_constant' /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:452:inconst_missing’
/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/inflector.rb:250:in
constantize' /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/string/inflections.rb:148:inconstantize’
/vendor/rails/actionpack/lib/action_controller/routing.rb:1284:in
recognize' /vendor/rails/railties/lib/dispatcher.rb:40:indispatch’
/vendor/rails/railties/lib/fcgi_handler.rb:168:in process_request' /vendor/rails/railties/lib/fcgi_handler.rb:143:inprocess_each_request!’
/vendor/rails/railties/lib/fcgi_handler.rb:109:in
with_signal_handler' /vendor/rails/railties/lib/fcgi_handler.rb:142:inprocess_each_request!’
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:600:in
each_cgi' /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:ineach_cgi’
/vendor/rails/railties/lib/fcgi_handler.rb:141:in
process_each_request!' /vendor/rails/railties/lib/fcgi_handler.rb:55:inprocess!’
/vendor/rails/railties/lib/fcgi_handler.rb:25:in `process!’
/users/home/michaelj/domains/dev.codeinmotion.com/web/current/public/dispatch.fcgi:24

So the first time it loads my extension fine but the second time it
can’t find it?

I do have rails in vendor/rails.

Suggestions?

Thanks-
Michael

First, make sure that your App is in production mode in environment.rb.

If that doesn’t solve everything, then you can force things to work with
explicit “load” calls:

i.e.

load
“#{RADIANT_ROOT}/vendor/extensions/page_attributes/app/models/page.rb”

Try putting an explicit load call to your events controller at the end
of your extension definition. (or at the end of some other controller in
radiant core).

Yes I know this is a hack, but it’s quick and dirty…

Thanks for the suggestions Jacob.

The way I solved this was by editing my xxx_extension.rb file in the
routes section:

old: map.connect ‘admin/tools/:action’, :controller => ‘admin/tools’
new: map.connect ‘admin/tools/:action’, :controller => ‘tools’

Weird, works fine on my local box but in production mode on textdrive
I have to run it this way.

If someone has ideas of why this is the case I’d love to hear it.

Thanks-
Michael

Michael,

Although I see why it was done initially, I personally have issues
with namespaced controllers. You probably failed to put the
controller inside the Admin module, or put it in the wrong directory,
which happens all the time. For the most part, it’s just easier to
change the route and keep the controller in the root namespace.

Sean