One of the niceties about working with Rails is how most plugins just work. Since plugins are tied to the framework, and just about everyone that works for web development uses Ruby, it gives a huge base of helpers and code to get you started unlike anything I’ve seen — outside of Java. ColdFusion has a very strong community, with many projects at RIAForge and many more added every week, but what makes Rails stand out is the common ground under which they’re implemented and integrated.
All ColdFusion frameworks have their own ways of creating helpers/plugins/services/whatever like this, but there’s no one “ColdFusion Way”. There are a few Rails plugins that evem me, a Rails novice, have been able to implement and reap the benefits in a relatively small time frame. What plugins am I using so far?
- ActionMailer TLS – Have you ever gotten annoyed needing to install a local email server to do your testing? With this plugin you can use Gmail for all your outgoing mail. There’s a 500 email limit or so, but for testing purposes it makes it easy to get setup — especially if you’re alternating between multiple computers. Another option would be to set this up to use Dreamhost or something of course. The advantage of using Google though is it’ll save all your outgoing mail as well, so you’ll be able to see exactly what was sent during testing without digging into logs.
- GeoKit – Google Maps plugin for Rails. This one has a lot to it. You can create entire maps without knowing the Google Maps API, with overlays of map popups and all that, run calculations on distance between points and geocode addresses (physical or IP) into latitude/longitude very easily. It answers questions like “Get all restaurants within 15 miles of the logged in user” with simple code like
Restaurant.find(:all, :origin => user_address, :within => 15). Imagine that returning a query with a “distance” column which has the distance in miles between the two.
- “Acts As Rateable”:http://www.juixe.com/techknow/index.php/2006/07/05/acts-as-rateable-plugin/ – If you have locations you’ll need to rate them right? Chances are there’s other things on your site that need rating as well, so this cleans up some of the code for this. It’s something that could be done without a plugin, sure, but adding “acts_as_rateable” to a model is all you need to get going.
- “ResourceController”:http://jamesgolick.com/resource_controller/rdoc/index.html – I only recently found this out, but it’s cleared up the repetitive code in some of my controllers. The idea is that it’ll setup all the boilerplate code in RESTful controllers, making it that much easier to get started. If you have nested resources in particular this cleans up the code for it quite a bit by providing helper functions for where in the execution chain of nested controllers the current call is at.
- “Restful Authentication”:http://agilewebdevelopment.com/plugins/restful_authentication – This seems to have to replaced ActsAsAuthenticated as the most used authentication plugin. Today I was going though a “Restful tutorial”:http://www.railsforum.com/viewtopic.php?id=14216 to expand on my current restful authentication setup. In not too long I had a nice roll based authentication system with email driven activation, reset and change password sections. Not bad for an afternoon.
- “Will_Paginate”:http://errtheblog.com/posts/56-im-paginating-again – Easy Pagination! What makes this pagination plugin great is the ease of use. If you’re returning an array of activerecord objects, like with
Model.find(:all), then you won’t have to change anything in your view to keep things working. Will Paginate also returns that same array — well sort of. The array that it returns can be looped over in the same way, but is also contains the pagination data, such as current page and results per page. Add this into a
will_paginate :gameswhich generates those all too familiar numbered pages and you have pagination. The only thing that needs to be done is changing the
find(:all)call to use the new paginate method. Any common Rails Plugins you can recommend?