Secure Rails Admin Backend With Authlogic and Multiple Sessions

January 26, 2010

Thoroughly supported, inconspicuously documented, authlogic lets you manage multiple user sessions -perfect if you want to allow users to login to your application under separate accounts, or as in the following case, if you want to build an administrative backend secure from potential session hijacks.

Posting Multipart File Uploads on the iPhone

November 8, 2009

Using an iPhone to post binary files like photos or video to a remote server is not a difficult task, but there’s a wide margin for inexplicable sinkholes ready to swallow precious time with formatting nuances or missing headers. I say this while kicking the muck off my boots myself, as trial by error and a measure of patchwork has brought me to following happy implementation.

Patching acts-as-taggable-on: column reference “context” is ambiguous

October 26, 2009

Certain errors in Rails send a shiver down the spine because they deal with generated SQL which can be such a dreadful problem to fix. Today I got the shivers from acts-as-taggable-on and the following error message:

PGError: ERROR: column reference "context" is ambiguous

The source of the problem is the plugin’s dynamic tag contexts and [...]

Web Hooks in Ruby on Rails

October 12, 2009

A recent issue of Rails Magazine published an article by John Nunemaker on web hooks in rails, along with a concise example for triggering hooks on models using an observer class. I’ve followed this lead, but found a few basic changes necessary to make the solution more tractable for use in a typical Rails API setup.

Improving Tag Ownership in acts_as_taggable_on

September 18, 2009

acts_as_taggable_on is a great plugin with some useful feature hooks like user-owned tagging. I’ve extended the tag owner hooks with a few finder methods to traverse tagger relationships, and squashed a crucial bug that rejects valid owner taggings during the taggable model’s save_tags callback.

Managing Local High Scores and Online Leaderboard for your iPhone Games Part 2/2

September 12, 2009

In the first part this tutorial I demonstrated how to save player scores for an iPhone game. In this post, I’ll explain how to add online support by building a high scores web service in Rails, securing the submissions, and using git to deploy (for free) onto heroku.
One of the principles behind this tutorial was [...]

Bug combining acts_as_taggable_on tagged_with scopes

September 8, 2009

My latest Sogeo work is getting quite a lot of distance out of tagging. With mbleigh’s acts_as_taggable_on I’ve been able to conveniently normalize several different data dimensions down into a tag model.
Modeling this was easy enough, but today I ran into an issue when constructing some of the more sophisticated filtering queries.
acts_as_taggable_on utilizes [...]

Managing Local High Scores and Online Leaderboard for your iPhone Games Part 1/2

September 6, 2009

Why high scores? Because the stamp of public achievement rewards players for investing their time and skill in your game; and because the one-upsmanship of ranking promotes a competitive social awareness which can make a title more enduring.

In this two-part tutorial I’ll explain how to model and store local and high scores in your iPhone game, and build a web service leaderboard with Ruby on Rails.

Activity Logs and Friend Feeds on Rails & pfeed

August 20, 2009

Friend networks and activity feeds are mainstay features of social media applications, and designing an implementation that won’t scar your code with the complexities of bidirectional logic and messaging queues is never easy.

iPhone: Responding to UITabBarController Touches

August 14, 2009

Responding to the iPhone’s UITabBarController touches should be a direct, uncomplicated process, but in fact requires you to establish a number of hooks throughout your code. There are many reasons you might wish to intercept a UITabBar action, either to cancel and return to a prior tab, to show an alert view, to conditionally push a stack of ViewControllers , and so forth. Here are the steps necessary to make that happen.