Photo-1 Photo-2 Photo-3 Photo-4 Photo-5 Photo-6

@brentmc79

@brentmc79

Full-time web developer. Part-time smart ass.

I'm Brent Collier.

After a year and a half as an engineer on Twitter's Trust & Safety team, I'm looking for my next gig. Contact me if you know of something interesting.

#

uninitialized constant User::Authentication

Posted on 01/22/2009

I've hosted acts-as-blogr on Slicehost for a while now, but I recently signed up for shared hosting through Dreamhost.  They had a promotion of 2 years of hosting for $22 which I couldn't pass up now that they support Passenger for Rails apps.  Anyway, I finally got around to deploying an app with Passenger and I had a little problem.

Upon doing the initial 'cap deploy:migrations', it failed with this error

  * executing "cd /home/brentmc79/brentmc79.com/releases/20090122070240; rake RAILS_ENV=production  db:migrate"
        servers: ["brentmc79.com"]
        [brentmc79.com] executing command
     ** [out :: brentmc79.com] (in /home/brentmc79/brentmc79.com/releases/20090122070240)
     ** [out :: brentmc79.com] rake aborted!
     ** [out :: brentmc79.com] uninitialized constant User::Authentication
     ** [out :: brentmc79.com] 
     ** [out :: brentmc79.com] (See full trace by running task with --trace)
        command finished
    failed: "sh -c \"cd /home/brentmc79/brentmc79.com/releases/20090122070240; rake RAILS_ENV=production  db:migrate\"" on brentmc79.com
    

This was clearly something to do with restful_authentication since it was complaining about User::Authentication.  I did a bit of googling, but I didn't come up with much.  Somebody mentioned renaming the plugin to not have a hyphen, but that just seemed silly.  Someone else mentioned some session/cookie issue, but I hadn't even made it to the browser.  It was failing on db:migrate.  Finally, someone mentioned that they had forgotten to include the plugin in their repo.  This got me to thinkin...

I knew that I had included the plugin, but I decided to take a look at the Github repo in the browser.  Here's what I saw:

 

The restful_authentication plugin was actually a cloned repo sitting inside my working copy.  I'm sure there's probably some clever way to enable a repo inside of a repo, but it was 2am and I just wanted it to work.  So I just rm'd the restful_authentication plugin from the vendor directory, download the tarball from Github, and extracted it back into vendor/plugins.  Using the tarball instead of the clone gives you all the code without all the git info.

I committed/pushed, then ran 'cap deploy:migrations' again and the database migrated with no uninitialized constant error.   Viola!  Unfortunately, then I just moved on to the next issue...

After a couple more tweaks and deploys, I finally had it up and running.