Strange Restful_Authentication Plugin Issue

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:

github-brent

The solution I needed to do was a bit different than the one described by Brent but close.

  1. Started off by deleting the vendor/plugin/restful_authentication directory manually.
  2. Did a commit/push of my project to Github and verified the folder was gone in the Github repo.
  3. I downloaded the tarball of the restful_authentication plugin from Github. 
  4. Once extracted, I copied the folder to vendor/plugins and named the folder restful_authentication.
  5. 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.
  6. 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.

Feedback

 avatar
#1
Matthew Williams
05.15.2009 @ 11:14 AM

It looks like it was being treated as a Git Submodule:

"Submodules allow foreign repositories to be embedded within a dedicated subdirectory of the source tree, always pointed at a particular commit."

See: github.com/.../developing-with

You could have also deleted the .git directory inside the plugin's root directory.

 avatar
#2
Cameron Booth
05.15.2009 @ 11:23 AM

Matthew already said what I was going to suggest, but it's a bit weird because I didn't know 'script/plugin install git:....' installed the plugin as a submodule.

Either way, another approach is to leave it as a submodule. The only catch is that the _very first_ time you checkout the code base on the server (or rather each time there's a new submodule), you need to go in and run 'git submodule init' from within the /shared/cached-copy folder on the server. There's probably a way to build that into capistrano I'm sure.

rbazinet avatar
#3
Rob Bazinet
05.15.2009 @ 11:36 AM

Thanks guys, this at least explains somewhat of why this would happen, so..it is a submodule. Is this a good or bad thing to be a submodule? It concerns me a bit because I have installed plenty of other plugins from github which I assume are submodules, but why is this particular plugin causing issues but not the others?

Do you either of you use restful_auth? How did you install it in your project?

Interesting indeed and thank you both for the help.

 avatar
#4
Cameron Booth
05.16.2009 @ 1:40 AM

Yeah, odd that this one installed as a submodule and others didn't seem to. Like I mentioned, I didn't think 'script/plugin install git://..." did submodules, so that's strange.

As to the benefit of submodules, they are nice if you want to be able to quickly bring in updates from the place you are getting the submodule...you just run "git submodule update" and voila, you'll have the latest code from that plugin. I think it's a matter of taste for sure, I prefer to update plugins (and gems) myself when needed, though it admittedly takes longer than it would with the submodule approach

 avatar
#5
توبيكات جديده
08.15.2009 @ 11:08 PM

thanxs very nice

 avatar
#6
car floor jack
08.28.2009 @ 12:06 PM

As to the benefit of submodules, they are nice if you want to be able to quickly bring in updates from the place you are getting the submodule.

» Trackbacks & Pingbacks

    No trackbacks yet.
Trackback link for this post:
http://accidentaltechnologist.com/trackback.ashx?id=407

Leave a Comment