Why Ruby on Rails frustrates me… January 11, 2009 at 11:00 pm

So I am now in week 4 of trying to switch to Ruby on Rails from CakePHP. It is truly a roller coaster ride.

On the upside, I have been very, very impressed with the true object-oriented nature of Ruby. Really, I can’t say enough here. The fact that you can override and extend pretty much anything in the language to your liking is just awesome. Everything is an object – just like Java or Javascript – but without the annoyances of an overwhelming required number of definitions or memory concerns. You can even overload symbols and other operators. The built-in introspection and modularity is just slick.

On the downside, I am continuing to have trouble taking advantage of this “goodness” so many speak of with Rails. I don’t think it’s because of lack of trying. I think it’s due to lack of good documentation.

As a practical example, let’s say I want to do something as simple as create a login generator that can integrate with LDAP as well as a local database. This is a practical scenario I’ve run into in the PHP world – I want to have Windows users use the same login/password on an intranet site as they do for their Windows credentials. But I also want a fallback mechanism so I can login when LDAP is broken, or when I need to create a special account for, say, a contractor who only needs temporary access and should not be allowed onto the Active Directory network. In PHP, you simply go to www.php.net/ldap for the LDAP pieces, or maybe do a search for a PECL library that handles LDAP for you. Then you cobble together a quick model, view and controller using CakePHP’s scaffolding and get the login and logout stuff done. Or you extend the CakePHP authentication modules that are well documented right within the CakePHP manual. Probably about two hours of work.

Now let’s apply this to Rails. Not knowing where to start, and not having a search box on the RubyonRails API page (there isn’t one – how silly), I try some Google-fu to find the equivalent in rails. The first relevant hit is a page that seemed like a match – http://wiki.rubyonrails.org/rails/pages/Authentication . An authentication wiki page on Rails own site. Seems legit.

But then I load the page and the first thing I am greeted with is:

“This article is part of the confusing world of Authentication in Rails. Feel free to help: AuthenticationNeedsHelp.”

ehh

Then I start examining the list of available plug-ins, gems and solutions to authentication that people have listed. Almost all of them are labeled either deprecated, incomplete or “good for beginning Ruby on Rails user.” Fine, I think, maybe one will work and I just have to find which one. So I start clicking into each page.

LoginGenerator seems relevant.

But scrolling through that page, the text and comments suggest that it no longer works for versions past 2.0.2. But don’t worry – it links to ANOTHER site that swears to be the real solution I am looking for! That’s here – http://wiki.rubyonrails.com/rails/pages/Acts_as_authenticated .

Woohoo! This page starts by proclaiming “Yay! (read why)” and then explains that THIS is the right place for an authentication system generator. As if the page already knew that all those OTHER pages one might stumble upon prior were total crap. But before I get too excited, I click on the link which states that “…you really want to see the official Acts As Authenticated Github.” So I bite – I click the link, and am whisked away to the project page, which states right at the top:

“Please note that acts_as_authenticated, is no longer developed/maintained”

WTF?!?!

So we go back to the drawing board – all the way back to the Wiki page we started with – and look for more. Restful_authentication seems to be the top item, so maybe I should have started there. Again, I click it, and the first comment mentions that some material links to the wrong source. ugh. It then lists four locations to get information. I start with the first one – the official plug-in homepage. It says it’s for rails 1.2. But I’m on Rails 2.2.2. [Sigh] Do I try it? Or go back to the drawing board?

Maybe I am missing something, but one strong part of PHP was the manual and the comments – the manual matched the methods and classes that were actually available almost 98% of the time, and were never incomplete in terms of broken. Does such a resource exist for Rails where I can go to a webpage to find plug-ins and they reliably work and are available? This has to be my #1 frustration with Rails at this point.

If you have comments, please add them. I’d love to hear solutions to how to better manage rails plug-ins, gems and other “goodies” that seem to just be scattered everywhere.

Leave a Reply

You must be logged in to post a comment.