Rails plugin directory revamp

22 May 2009

A lot has happened to the world of Ruby on Rails since the Rails plugin directory first launched back in 2005, and I have finally caught up. :) Of course I've been making changes all along the way, but today I'm launching a rewrite that makes the plugin directory current on all the latest and greatest.

Back when the site first launched, the state of the art Rails deployment was lighttpd with fastcgi. Ah, those were the days. :) Since then I've moved to lighttpd with mongrel, then nginx with mongrel, and now it's running Apache with Passenger. For search, the best option back then was ferret, and let me tell you, I've gotten more than a few exception emails from ferret. But now the site is using sphinx for search, which I've been using in other apps for quite a while. Of course, some things don't change. Even though I'm updating the UI, it's still a freely available template, since I haven't gotten much better at web design in the past 4 years. :)

The biggest change for me is due to something that didn't exist in 2005: GitHub. Now that just about every plugin is hosted there, I wanted to make it super easy to get plugins listed on GitHub into the plugin directory, so now there's a button you can use when creating a plugin that will take your GitHub url and suck in as much data as it can about your plugin, so you don't have to do as much work to add it to the directory. I even have a bookmarklet you can use to publish your plugin while you're looking at the GitHub page for your plugin: Publish plugin. Just drag that to your bookmarks bar, click it when you are looking at the GitHub page for any plugin, and a new window will pop up with the plugin information pre-filled for you. Thanks to the GitHub guys for their great API that makes that easy!

So enjoy the new Rails plugin directory -- with extra-fresh Rails goodness and over 1,300 plugins in the database.



Lots of Rails Plugins

31 December 2008

Since it's the last day of 2008, it seems like a good time to take a quick look at the number of plugins in the Rails plugin directory.

When I first created the plugin directory while at the Canada on Rails conference in April 2006, I started the database with 66 plugins scraped from the Ruby on Rails wiki. Since then, we've seen around 37 new plugins a month being added to the database. That's pretty cool, especially since I don't even catch all of them!

Check out this chart created by Xavier Noria for his presentation at the Conferencia Rails in Madrid in early November:

Here at the end of 2008, we have over 1,200 plugins in the database. Keep 'em coming! :)



Drag and Drop Sorting with JQuery and Rails

31 October 2008

I decided to switch to JQuery recently, and I've been enjoying it. Part of the fun is trying out all the plugins that are available. :) This past week I needed to do drag and drop reordering for the first time since moving over to JQuery, so I thought I'd share some of the code that makes this really easy.

With Prototype, you can use the javascript that comes with the Rails distribution, but for this case I decided to go with the Table Drag and Drop JQuery plugin, as it had the right combination of functionality and ease of use. Once the plugin is in your project, getting a sortable table is very simple.

First up is the view, with the javascript injected into the head section of the document by using content_for. You'll note that for this simplified example an unordered list actually would have been better than a table, but in the original app I wanted to use a table for this list of items, so I wanted to make sure to use a plugin that supported that.

After creating the table, we simply use the document ready event to add some behavior to it. The plugin serializes the ids of the table rows in an array and sends that array, named after the table id, as a parameter to the controller. I add the authenticity token to the parameters sent via AJAX, and if the action was successful I just pop up an alert.

The controller iterates over all the specifications, checking the position in the db (see the acts_as_list plugin) versus the position in the array that was sent in the request. For the items that are affected, it updates the position in the db. Since we are only calling this action via AJAX, we just render nothing and indicate a successful status.

Of course there are few bits you can pretty up, both in the view and the controller, but that's the basic approach. Fast, easy, and client-approved. :)



Sample OpenID application updated for latest Rails and OpenID gem

27 May 2008

Some of my more popular blog posts are the ones detailing my work on modifying the acts_as_authenticated plugin to work with the open_id_authentication plugin, giving you both OpenID and username/password logins in your Rails application -- here, here and here. After a few inquiries, I have now updated my sample OpenID application to work with the latest Rails (2.x), the latest ruby-openid gem (2.0.4), and the restful_authentication plugin, and I've made it a free download at Rails Kits.

I've taken these two fantastic plugins, made some nips and tucks to get them working well together, and put it up for download at the OpenID Rails Kit page.

Getting started with OpenID on Rails is as simple as downloading the Kit, installing the ruby-openid gem, and loading the included schema. It even supports Yahoo's implementation of specifying a different identity URL than the one the user supplies when creating an account (part of the OpenID 2.0 spec), as discussed here.

Enjoy!



Rails plugin packs at the plugin directory

07 April 2007

Just after RailsConf last summer, Luke Redpath introduced plugin packs to the world. Not long after he implemented the idea, he rolled it into the Rails Plugin Tool. It's a fantastic idea, allowing you to install an entire list of plugins in one shot. Now the idea has been kicked up a notch.

I mentioned previously that I would be making the favorites feature at the Rails plugin directory a little more handy, and now I have. When you log in to your account at the directory and view your favorite plugins, you'll now see instructions on how to use the plugin pack installation feature of RaPT with your favorites. In short, once you create your list of favorite plugins at the site, you can then install all of those plugins with one RaPT command.

Try it out. It's fun. :)