It’s that time again, to summarize a few interesting Rails links to highlight some of the best of the community. All of these were initially covered on the Ruby5 Podcast, the twice weekly Ruby newscast.
Rails 3 Content
The next Rails3 Bugmash is taking place May 15th and 16th. If you’ve never contributed to Rails, this is your chance to give back a little and do your part to make Rails 3 the best version ever.
To get a complete picture of routes in Rails 3, Rizwan Reza covered it best in an article over on the Engine Yard blog. If you dig the Engine Yard Rails 3 content, they recently created Rails Dispatch, where they have articles and screencasts published weekly.
Alex Maccaw recently used the Rails 3 ActiveModel abstraction to build an ActiveRecord-like in-memory database called Supermodel. You get all of the ActiveRecord goodness, such as validations, callbacks, and observers, but with none of that database headache.
As you may already know, the arel library from Rails 3 gives us a great new syntax for creating queries. Under the covers, arel converts your where conditions into sql is by using something called a PredicateBuilder. Ernie Miller recently put out a plugin called MetaWhere that takes advantage of these PredicateBuilders to give arel even more functionality.
Lastly, if it’s still not clear to you how awesome bundler is, go read Yehuda’s recent post on the topic.
Do you ever find the need to access current_user in your models? This is often required when you’re logging model/table changes on a per user basis. There are many hacks to accomplish this, but David Bock has a gem called SentientUser which does this a little cleaner.
Once your websites goes big and you start to worry about malicious user attacks, you may want to take a look at Arto Bendiken and Brendon Murphy’s Rack::Throttle Middleware. Throttle does just want you think it does, allowing you to limit the number of requests a user can ping your site (per second).
Lastly, Ryan Bates released version 1.1 of CanCan, his authorization and permission library that allows you to restrict what your users can do throughout your application.
You may have heard that the Facbook API is now adopting OAuth2. If you’re ready to jump in, Michael Bleigh released the OAuth2 gem just last week.
Rails makes a great RESTful backend for iPhone applications, and recently Anthony Moralez created APN_on_rails which makes it super easy to do Apple Push Notifications.
There’s no need to reinvent the wheel if your Rails application needs e-commerce, this is where the Spree gem comes in, which recently hit version 0.10.0, containing a bunch of new features.
Does your Rails application have a monster testing library that takes forever to run? Then it may be time to take a look at Hydra by Nick Gauthier, a distributed testing framework which allows you to run your tests in parallel locally or across remote servers.
Some people think cucumber can be too verbose for integration tests (which clients may never read). If you think cucumber is for vegetarians, then perhaps it’s time to taste some Steak by Luismi Cavalle. Steak is a small library which helps you generate quick and clean acceptance/integration tests using RSpec.
Talking about RSpec, there are some new conventions out there to clean up your old RSpec code. If you haven’t started using “Let”, then it may be time to look through a few of Jon Larkowski’s slides.
Additional Useful Libraries
If you ever find yourself with odd memory issues then it’s probably time to use memprof.com, a new web service by Joe Damato and Ruby Hero Aman Gupta. Memprof allows you to collect memory usage information from a Ruby process and immediately upload and view it using an intuitive web interface.
Rails applications are often full of forms, and sometimes you even need to give your clients the ability to create different types of forms or surveys. This is where the Census gem comes in, providing an admin interface for creating forms, and even the ability to search through the results.
To wrap things up, delayed_job recently hit 2.0, and you’ll want to upgrade if you have an older version. The new version has some performance improvements and adds support for non-ActiveRecord ORMs.
To keep track of Ruby conferences check out Ruby There, a listing of all the upcoming conferences and even when the Call for Proposals are due.
If you have any stories/libraries you’d like to spread the word about, feel free to email firstname.lastname@example.org and we’ll at least get you covered on the podcast. Thanks!
Image Credit: Blue Sky on Rails by ecstaticist, Analog Solutions 606 Mod by Formication, Rainbow by One Good Bumblebee. Orange County Security by henning, remember by tochis, Darwin Was Right About Media Players! by Neeku, remote controls by redjar.