# Help deploying 0.2 of my extension...getting weird behavior

**URL:** <https://www.ruby-forum.com/t/help-deploying-0-2-of-my-extension-getting-weird-behavior/89549>\
**Category:** Radiant CMS\
**Created:** [March 21, 2007, 4:59am UTC](https://www.ruby-forum.com/t/help-deploying-0-2-of-my-extension-getting-weird-behavior/89549 "2007-03-21T04:59:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsmorris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@jsmorris](https://www.ruby-forum.com/u/jsmorris)\
**Post date:** [March 21, 2007, 4:59am UTC](https://www.ruby-forum.com/t/help-deploying-0-2-of-my-extension-getting-weird-behavior/89549/1 "2007-03-21T04:59:23Z")

</div>

I want to validate that I am deploying my 0.2 version of my extension  
correctly. I need to rule out that it is a radiant issue.

I have a radiant 6.0 rc1 (application mode) installed and running on  
my hosting site (RailsPlayground). I just recently updated my  
extension and wanted to deploy that to production. I use a manual  
process right now (yes, I need to learn capistrano) so I just FTPed my  
0.2 version over the 0.1 files.

I then ran  
rake production db:migrate:extensions

My db schema changes show up in the database, so that seemed to work  
just fine.

I go to my site and I now see that I have my two new tabs on the admin  
screen (version 0.1 of my extension just had one). So I go to the tab  
that is in both version and I see the 0.1 version of it. None of my  
changes are there. Then I go to the new tab that is only in version  
0.2 and it throws an error.

Application error (Apache)

Change this error message for exceptions thrown outside of an action  
(like in Dispatcher setups or  
broken Ruby code) in public/500.html

I have double checked that the files are out there and the correct  
version, but am stumped as to what is wrong.

I made sure to kill all the FastCGI processes (suggested by  
RailsPlayground), but that doesn’t help. And the real kicker is that  
once and only once I saw the new changes displayed.

Does radiant do something with the extensions that needs to be cleared  
out? Is my hosting provider doing something that I am not aware of?

It is probably something obvious, but I just cannot see it. Any help  
would be appreciated.

Thanks,  
Jason

---

<div class="post-metadata">

**Author:** ![jsmorris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@jsmorris](https://www.ruby-forum.com/u/jsmorris)\
**Post date:** [March 21, 2007, 5:14am UTC](https://www.ruby-forum.com/t/help-deploying-0-2-of-my-extension-getting-weird-behavior/89549/2 "2007-03-21T05:14:24Z")

</div>

Jason,  
My first suggestion is to switch your app into development mode and  
see what the error your getting is. My hunch is a file permission  
issue, but it’s hard to say without a real error message.

Good Luck,  
BJ Clark

---

<div class="post-metadata">

**Author:** ![jsmorris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@jsmorris](https://www.ruby-forum.com/u/jsmorris)\
**Post date:** [March 21, 2007, 7:26am UTC](https://www.ruby-forum.com/t/help-deploying-0-2-of-my-extension-getting-weird-behavior/89549/3 "2007-03-21T07:26:31Z")

</div>

BJ…Thank you

Your reminder to up the log level to debug forced me to remember  
something odd about my installation.

I develop my radiant extension on a mac os x 4.9 ruby 1.8.5 RoR 1.2.1  
running on a mongrel 1.0.1 , but I have to add two things when I  
deploy. First, I have to add Admin:: to each of my extension  
controllers and I also have to put my extension views in the  
app/views/admin. This defeats the purpose of have the extensions…I  
still have to mix the views from radiant and my extension.

My hosting environment…well the cheaper package, only uses fastcgi,  
but I don’t know if that causes this problem.

Does anyone know why I would have to add Admin:: to my extension  
controllers and change the location of my view files? As you can see  
this is rather annoying and prone to error. I just cannot drop my  
extension to the vendor/extension folder and have things work.

BJ…thanks again.

Jason

---

<div class="post-metadata">

**Author:** ![jsmorris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@jsmorris](https://www.ruby-forum.com/u/jsmorris)\
**Post date:** [March 21, 2007, 1:49pm UTC](https://www.ruby-forum.com/t/help-deploying-0-2-of-my-extension-getting-weird-behavior/89549/4 "2007-03-21T13:49:19Z")

</div>

I hate to sound like a broken record, but just because your controllers  
appear in the “admin/” URL path does not mean they have to be in the  
Admin module. For example, in the LDAP extension:

define\_routes do |map|  
map.connect ‘admin/ldap/:action/:id’, :controller =\> ‘ldap’  
end

([http://dev.radiantcms.org/radiant/browser/branches/mental/extensions/ldap/ldap\_extension.rb](http://dev.radiantcms.org/radiant/browser/branches/mental/extensions/ldap/ldap_extension.rb))

Simple as that. IMHO, it’s best not to mess with module namespaces  
unless you absolutely have to.

Sean

---

<div class="post-metadata">

**Author:** ![jsmorris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@jsmorris](https://www.ruby-forum.com/u/jsmorris)\
**Post date:** [March 22, 2007, 5:32am UTC](https://www.ruby-forum.com/t/help-deploying-0-2-of-my-extension-getting-weird-behavior/89549/5 "2007-03-22T05:32:25Z")

</div>

On Mar 22, 2007, at 12:20 AM, jsmorris wrote:

> 2007-03-20 00:18:17) [GET]  
> Session ID: fbe9e7f1f92a5776b70cfcc3a04ad1d1  
> Parameters: {“action”=\>“index”, “controller”=\>"/admin/lectures"}
> 
> NameError (uninitialized constant Admin::LecturesController):

It’s been a late night, but isn’t this happening because it is  
resolving the attribute “controller” to “/admin/lectures”, which is  
due to your routes configuration? Therefore, were you to either fix  
that, or create an admin directory in your extension’s app/  
controllers directory and place lectures.rb there, wouldn’t things  
work within the extension?

adam williams

---

<div class="post-metadata">

**Author:** ![jsmorris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@jsmorris](https://www.ruby-forum.com/u/jsmorris)\
**Post date:** [March 22, 2007, 5:21am UTC](https://www.ruby-forum.com/t/help-deploying-0-2-of-my-extension-getting-weird-behavior/89549/6 "2007-03-22T05:21:25Z")

</div>

I totally agree, but the reason I moved my views and added the Admin::  
namespace to my extension controller was because radiant didn’t find  
them in the appropriate spot in my extensions folder. It threw an  
error. Thus it was looking for them in the wrong place. So I moved  
them to where it was looking for them just to get my extension to  
work. This is the error I get (when I don’t add the Admin namespace  
to my extension’s controller):

Processing ApplicationController#index (for 70.190.32.209 at  
2007-03-20 00:18:17) [GET]  
Session ID: fbe9e7f1f92a5776b70cfcc3a04ad1d1  
Parameters: {“action”=\>“index”, “controller”=\>"/admin/lectures"}

NameError (uninitialized constant Admin::LecturesController):  
/vendor/rails/activerecord/lib/…/…/activesupport/lib/active\_support/dependencies.rb:267:in  
`load_missing_constant' /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:453:in`const\_missing’  
/vendor/rails/activerecord/lib/…/…/activesupport/lib/active\_support/inflector.rb:251:in  
`constantize' /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/string/inflections.rb:148:in`constantize’  
/vendor/rails/actionpack/lib/action\_controller/routing.rb:1258:in  
`recognize' /vendor/rails/railties/lib/dispatcher.rb:40:in`dispatch’  
/vendor/rails/railties/lib/fcgi\_handler.rb:168:in `process_request' /vendor/rails/railties/lib/fcgi_handler.rb:143:in`process\_each\_request!’  
/vendor/rails/railties/lib/fcgi\_handler.rb:109:in  
`with_signal_handler' /vendor/rails/railties/lib/fcgi_handler.rb:142:in`process\_each\_request!’  
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:612:in  
`each_cgi' /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in`each’  
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in  
`each_cgi' /vendor/rails/railties/lib/fcgi_handler.rb:141:in`process\_each\_request!’  
/vendor/rails/railties/lib/fcgi\_handler.rb:55:in `process!' /vendor/rails/railties/lib/fcgi_handler.rb:25:in`process!’  
dispatch.fcgi:24

Now, after adding the Admin namespace to my extension controller and  
not coping the views to radiant/app/views/admin directory, I get this  
error:

Processing LecturesController#index (for 70.190.32.209 at 2007-03-21  
00:37:46) [GET]  
Session ID: fbe9e7f1f92a5776b70cfcc3a04ad1d1  
Parameters: {“action”=\>“index”, “controller”=\>"/admin/lectures"}  
e[4;36;1mSQL (0.048391)e[0m e[0;1mSELECT count(\*) AS count\_all  
FROM lectures e[0m  
e[4;35;1mLecture Load (0.000248)e[0m e[0mSELECT \* FROM lectures  
ORDER BY date\_and\_time DESC LIMIT 0, 10e[0m  
Rendering layoutfalseactionlist within layouts/application

ActionController::MissingTemplate (Missing template  
…/config/…/app/views/admin/lectures/list.rhtml):  
/vendor/rails/actionpack/lib/action\_controller/base.rb:1205:in  
`assert_existence_of_template_file' /vendor/rails/actionpack/lib/action_controller/base.rb:804:in`render\_file’  
/vendor/rails/actionpack/lib/action\_controller/base.rb:738:in  
`render_with_no_layout' /vendor/rails/actionpack/lib/action_controller/base.rb:863:in`render\_without\_layout’  
/vendor/rails/actionpack/lib/action\_controller/base.rb:798:in  
`render_action' /vendor/rails/actionpack/lib/action_controller/base.rb:748:in`render\_with\_no\_layout’  
/vendor/rails/activerecord/lib/…/…/activesupport/lib/active\_support/deprecation.rb:43:in  
`silence' /vendor/rails/actionpack/lib/action_controller/base.rb:747:in`render\_with\_no\_layout’  
/vendor/rails/actionpack/lib/action\_controller/layout.rb:244:in  
`render_without_benchmark' /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in`render’  
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure' /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in`render’  
/vendor/extensions/education/app/controllers/lectures\_controller.rb:4:in  
`index' /vendor/rails/actionpack/lib/action_controller/base.rb:1095:in`send’  
/vendor/rails/actionpack/lib/action\_controller/base.rb:1095:in  
`perform_action_without_filters' /vendor/rails/actionpack/lib/action_controller/filters.rb:632:in`call\_filter’  
/vendor/rails/actionpack/lib/action\_controller/filters.rb:634:in  
`call_filter' /vendor/rails/actionpack/lib/action_controller/filters.rb:638:in`call\_filter’  
/vendor/rails/actionpack/lib/action\_controller/filters.rb:438:in  
`call' /vendor/rails/actionpack/lib/action_controller/filters.rb:637:in`call\_filter’  
/vendor/rails/actionpack/lib/action\_controller/filters.rb:638:in  
`call_filter' /vendor/rails/actionpack/lib/action_controller/filters.rb:438:in`call’  
/vendor/rails/actionpack/lib/action\_controller/filters.rb:637:in  
`call_filter' /vendor/rails/actionpack/lib/action_controller/filters.rb:638:in`call\_filter’  
/vendor/rails/actionpack/lib/action\_controller/filters.rb:438:in  
`call' /vendor/rails/actionpack/lib/action_controller/filters.rb:637:in`call\_filter’  
/vendor/rails/actionpack/lib/action\_controller/filters.rb:619:in  
`perform_action_without_benchmark' /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in`perform\_action\_without\_rescue’  
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure' /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in`perform\_action\_without\_rescue’  
/vendor/rails/actionpack/lib/action\_controller/rescue.rb:83:in  
`perform_action' /vendor/rails/actionpack/lib/action_controller/base.rb:430:in`send’  
/vendor/rails/actionpack/lib/action\_controller/base.rb:430:in  
`process_without_filters' /vendor/rails/actionpack/lib/action_controller/filters.rb:624:in`process\_without\_session\_management\_support’  
/vendor/rails/actionpack/lib/action\_controller/session\_management.rb:114:in  
`process' /vendor/rails/actionpack/lib/action_controller/base.rb:330:in`process’  
/vendor/rails/railties/lib/dispatcher.rb:41:in `dispatch' /vendor/rails/railties/lib/fcgi_handler.rb:168:in`process\_request’  
/vendor/rails/railties/lib/fcgi\_handler.rb:143:in  
`process_each_request!' /vendor/rails/railties/lib/fcgi_handler.rb:109:in`with\_signal\_handler’  
/vendor/rails/railties/lib/fcgi\_handler.rb:142:in  
`process_each_request!' /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:612:in`each\_cgi’  
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in  
`each' /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in`each\_cgi’  
/vendor/rails/railties/lib/fcgi\_handler.rb:141:in  
`process_each_request!' /vendor/rails/railties/lib/fcgi_handler.rb:55:in`process!’  
/vendor/rails/railties/lib/fcgi\_handler.rb:25:in `process!’  
dispatch.fcgi:24

I don’t have to modify anything locally, so my local environment works  
without have to do these extra steps. Thus my suspicion is that due  
to the different setups (mongrel vs FastCGI) between my dev  
environment (my computer) and my production (hosting) environment  
causes radiant to behave differently.

I am a still learning RoR, so I am looking for some advice on how to  
troubleshoot this problem. Is the code that tells radiant where to  
look dependent on FastCGI and mongrel?

My define\_routes look like this in my\_extension.rb file

define\_routes do |map|  
map.connect ‘/admin/education/:action’, :controller =\>  
‘/admin/lectures’  
map.connect ‘/admin/grandrounds/:action’, :controller =\>  
‘/admin/grandrounds’  
end

I very much would like my extension to act like the LDAP extension and  
not have to mess with manual moving of my views and adding the  
namespace, but I just don’t know what to fix and more specially what  
the fix is that would make my radiant work in production and still  
continue to work in development.

Jason

---

<div class="post-metadata">

**Author:** ![jsmorris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@jsmorris](https://www.ruby-forum.com/u/jsmorris)\
**Post date:** [March 23, 2007, 6:29am UTC](https://www.ruby-forum.com/t/help-deploying-0-2-of-my-extension-getting-weird-behavior/89549/7 "2007-03-23T06:29:54Z")

</div>

Adam…I owe you one! Thank you!

Your observation was correct, because of the way I defined my route in  
my extension caused it to act the way it did.

My old routes where defined like

define\_routes do |map|  
map.connect ‘/admin/education/:action’, :controller =\>  
‘/admin/lectures’  
map.connect ‘/admin/grandrounds/:action’, :controller =\>  
‘/admin/grandrounds’  
end

Now, they look like this

define\_routes do |map|  
map.connect ‘/admin/education/:action’, :controller =\> ‘lectures’  
map.connect ‘/admin/grandrounds/:action’, :controller =\> ‘grandrounds’  
end

I am not sure why I thought they needed to be like that, but I am  
still learning.

Thanks again,  
Jason
