A copy of ApplicationController has been removed from the module tree but is still active! You got this error... and now you don't know what to do. Well i can offer a suggestion or two on how to fix it.
Symptoms
You may be trying to update a plugin that is conflicting with ApplicationController. You'll also notice that this error happens when you try to reload the same page, or even move a different view within the same directory. For instance, if you load plugin/index and the try to reload OR go to another link say plugin/new, you get this error.
Hit me nerbie69! Solve my problems
Well dude, you got way too many for me to solve, but this one is on me.
All douchery aside, i solved my error by deleting some of the leftover cruft of having a generator plugin, that i converted into a engines based plugin. github nerbie69/railstat plugin check out the forked project for the current generator based script.
#OLD code require_dependency 'path_tracker'
class RailStatController < ApplicationController include PathTracker
before_filter :extract_subdomain ....
#new code notice the difference class RailStatController < ApplicationController unloadable include PathTracker
before_filter :extract_subdomain ...
Since ApplicationController is an unloadable class, we too had to match it's unloadability in our app/controllers directory of our engines based plugin. Also, we don't need the require statement, as you do when you are using a generator plugin, if you are referencing the lib directory. The engines takes care of that for you too.
Wrap it up Johnny!
Ok, engines rock. Also, you can apply this code to any of these stupid errors you might get in the future for other controllers and plugins.
Sometimes, try as we may, things aren't always as advertised in this community of ours. So it is a good when things go exactly as planned
Instructions on using the plugin are well written in the README, so i won't bore you with those details, but if you have ever wanted to make a plugin that had the same familiar structure as your rails app', then this is for you. All you need to do is create a plugin and then add the same app directory structure in the root folder of the plugin.
Predictions
Theoretically you can make all of your controller, models and views as plugins, making your app act almost like it's own SAAS appliance. If you have a generator style'd plugin, there is no reason not to use engines. Less coding for you, the plugin creator.
Examples of Hot Rails Engines Action (HREA?)
In fact, i just put the finishing touches on my fork of the rails stat plugin, that was purely a generator script, basically. Now in my forked version, the engines plugin takes care of generating static code within an app. And that is pretty frickin cool.
I'm updating a plugin that works in Rails 2.2.2 development, yet borks in a production site using 2.1.0.
undefined method `render' for # Rails::Generator::Commands::Create:0x7fdf1caaa2c8
right now, Here is what the problem was
in my generator script i had the usual code m.template "app/views/rail_stat/hits.rhtml", "app/views/rail_stat/hits.rhtml" m.template "app/views/rail_stat/lang.rhtml", "app/views/rail_stat/lang.rhtml"
Now inside of hits.rhtml is the following line < %= render :partial => 'menu' % >
For some reason the render part fudges everything up. if i delete that line, the files go through with no problem.
Solution
When generating erb templates, the Rails::Generator needs to use an extra percentage sign whenever you call specific erb calls. For instance, i only had used < %= render :partial => 'menu' % > but i should have used < %%= render :partial => 'menu' % > Again, notice the extra % percentage sign in the second code bit. I'm sure there may be a better reason but the second % sign acts almost as a buffer and tells m.template to print the erb code in the new file? Again, that may be too simplistic of an answer, but that is what it seems like to me.
Theme_support plugin for rails is fully working in Rails 2.2.2
I'll work with jystewart from github to get the fix onto his version, as that is what i got to work. Here is the link to Theme_support on github. Alegria!
Let the good times roll gents. Rick Okasik and the cars once sang that song about this exact moment in time. The day I transferred my existing ruby on rails site from a shared host to slicehost.
Preamble - Reasons why, etc...
My shared hosting account at a2 has come to an end. They have been having a couple of days worth of outages here and there. Nothing too bad, usual disk failure kinds of stuff, but what really got my goat was this. A bug in cpanel that didn't allow the mongrel server to restart. So my site would be down for an eon, because they restarted the server or apache or something (never got straight answers). Now i'm a patient guy, but in terms of my website as a business, they were messing with my livelyhood. Good intentions or not, it sucked for that reason.
So the time has come to grow up and move to slicehost. I've tried Linode but i prefer slicehost. Both really offer the same principle offerings and are strictly/typically linux based servers, so i liked these two. But for some reason, slicehost resonated more with me. Just a thing i have, no fault of anyones.
Steps involved in transferring an existing app to a new server
I'll be chronicling my journey through transferring a rails app from a shared host to a VPS like slicehost. Here are the steps I took to move the server:
Backed up MySQL database on old server
Ftp'd backup db to new server
Copied app code to new server
Imported DB onto new server
Fixed app settings to let it run properly, such as action mailer, etc.
Updated DNS records to reflect the switch.
For the record, i already have a working passanger/mail system/rails stack on slicehost. I will chronicle what I needed to do to get this to work. However, your mileage may vary and if you screw up anything, even because of my instructions, i'm sorry, but that's on you and i won't and can't be held responsible. You've been warned.
Good, got that crap out of the way, on with the show.
As i'm using the command line for all/most of this transfer, a great resource for zipping files was About.com. Although not as sexy to use, it had all i needed. I used the following commands:
zip -r app_new app -x \*.log
Notice the -x which will exclude your stupidly huge log files. I need to find a better way to manage them.
By the way i went from 40mb zip file with logs to 10.5mb zip file. need i say more
FTP code and .sql file to New Server
No explanation really needed here. I used ftp from old server to my desktop and then i used sftp onto new server at slicehost. Your mileage may vary, but you get the idea.
Unzip code into new /var/sites/ directory
I unzipped the code into a web-applicaton chmod'd directory. unzip app.zip
I ended up creating a new user, just to be safe. Probably no need to do this, as you can keep the same one from your old server, but just in case. I just followed this Slicehost article on creating Mysql users. Grant All privleges, as he shows in the article.
install all your outstanding gems
Since i forgot which gems i need, and I am not ready to upgrade this app to 2.2.2 yet, as it's in rails 2.0.2, I need to go to the old server, and pull off all the gems i used, and reinstall them on the NEW server. Once this is done, we can setup the config files for actionmailer and the db itself.
Well it looks like it's the old rmagick gem that was the troublsome one. Thanks to enrailed.net for helping me out with this one. It's weird to me how i followed the same steps using aptitude and I got an error, but if i use apt-get, i was fine... whatever eh! Oh and gem install rails -v 2.0.2 just hung there, so i said screw it, and i'm going to go with the one i have on there 2.1.2.
Lastly for all UBUNTU Hardy users that don't know.... update your ruby gems. the POS that is shipped with that ubuntu version will disappoint you, if it hasn't already. Thanks to Mike's post here at a fresh cup blog you'll find out how more. Simply put, just run sudo gem install rubygems-update sudo update_rubygems
Update Config and database files
so you'll need to update anything in your config/environment.rb file that was server specific, such as actionmailer settings. Also, make sure your config/database.yml file reflects your NEW database.
Update your server settings
I, like most of the free rails world, are now using passanger to serve our app. If you aren't, run, don't walk, to the nearest passanger downloading station and fricking do it! Mongrel's time has passed, much like zed shaw's rants. It meets my needs, that is for sure.
I added the following code to passanger: ServerName sitename.com ServerAlias www.sitename.com DocumentRoot /var/rails/sitename/public
Since i have two other sites on my slice, i need to make sure that the NameVirtualHost *.80 is only added to the "first" site or in other words, only once.
Change your DNS records on your slice and with your Registrar
You'll need to change where your DNS is pointed, i.e., from the OLD server to the NEW one. Slicehost makes that part easy with their DNS manager. For the registrar part, you need to go to the registrar of record, in order to point it to the new settings. I change the registrar's record first, then i change mine on slicehost. But again, that's what i've done.
Restart the App and you are done
I think that is it friends. You should have the same app as you had before working on a new server. This wasn't rocket-science but it was a good list of 'things you need to do' when converting over to a new server.
To do...
I'll post how i got a multi-website postfix configuration going on my slice. I've yet to find an easy tutorial that works... but i'm looking. Thanks everyone. The good times are rolling again.
So i have tried my damnedest to make this work. I get an error as follows:
undefined method `compute_public_path' for # So, for some reason in theme support i am getting this crazy error, where in Rails 2.0.2 i did not, and in another project, which was Rails 2.1.2 using the "old" theme support, i did not get either
Possible Solution (TBD)
It appears that the compute_public_path method is now a private method of the class AssetTag in the module ActionView::Helpers::AssetTagHelpers.
What I still need to figure out
How in the hell do i link this 'sub class' AssetTag to the Module line in the rhtml_helpers.rb file in theme_support? I've tried various configurations to no avail. Who out there is a plugin god and can help out?
Commentary: This plugin always has to be updated after every version of a rails upgrade? I don't know why that is however? Perhaps it's the most unluckiest of plugins? carma? something... but like a trooper, it keeps on licking and ticking.
If you are using theme support and have recently upgraded your app to 2.2, you'll need to fix this plugin before you get anywhere. luckily jystewart from github has patched the plugin to work with 2.2. from what i see it may even fix it for a while, so that finally we won't have to keep patching this thing.