I was working late last night trying to get a new user interface design implemented on one of my Ruby on Rails applications while at the same time getting an initial authentication bit done using Rick Olson?s awesome restful_authentication plugin.
I had some migration updates so I can the usual:
cap deploy:migrations
During the stream of text output by Capistrano I received an error:
uninitialized constant User::Authentication
My initial thought was that I must have missed some configuration setting on my server, but after looking around for a bit I could not find what I might have left off. The error indicated with was something to do with the restful_authentication plugin but testing in both development and production worked fine (of course).
Some searching around the web revealed a few suggestions ranging from making sure the restful_authentication directory contained an underscore and not a hyphen to various Rails versioning issues. This application was working just fine on Rails 2.2.2 in development so I was confident it was not the issue.
I finally came upon a post by Brent Collier of Intridea who had the same issue as I experienced. I had installed this plugin as I do with other plugins hosted on Github with the command script/plugin install git://github.com/technoweenie/restful-authentication.git
. The plugin installed this way is a local git repository from the one stored on Github. Taken from Brent?s blog, the way the restful_authentication plugin appears in the Github repository was the same as was appearing in mine:
The solution I needed to do was a bit different than the one described by Brent but close.
- Started off by deleting the vendor/plugin/restful_authentication directory manually.
- Did a commit/push of my project to Github and verified the folder was gone in the Github repo.
- I downloaded the tarball of the restful_authentication plugin from Github.
- Once extracted, I copied the folder to vendor/plugins and named the folder restful_authentication.
- Did a commit/push again to Github and looked at the folder in the repo to see if it looked like all the others. Indeed it did.
- Finally, ran
cap deploy:migrations
and all was good.
This was a very strange exercise and I would really like to know why this happened and the proper procedure to manage plugins which are a git repo themselves. If anyone has an explanation and fix, I will update this post to reflect it.