.

Coffee Powered

code and content

Category Archives: Rails

Powerful, easy, DRY, multi-format REST APIs

Rails’ baked-in REST support is great. Build your app right, and you can expose a programmatic interface to your users for free. That said, many times providing views in non-HTML formats tends to be bulky and unwieldy. You end up with either very brittle representations of your data, or extremely bulky respond_to blocks in your [...]

Hold the RJS, please.

Rails does a great job at many things, but one of the most consistent stumbling blocks I see in #rubyonrails is RJS. It complicates many things that just don’t need to be that complex, especially when using a Javascript helper library like Prototype or jQuery. Keep things simple! One little helper, and your AJAX requests [...]

Stupid attachment_fu tricks, part 1

attachment_fu is fantastic, but it’s a bit limited for some purposes. Ever wanted to upload data from a URL instead of making people upload files? It’s a common problem! Presume that we have a model named Image, which is our target for attachment_fu. Adding URL upload capability is surprisingly simple: There you go. All you [...]

Jabberish: making Rails talk back

Ever wanted to do IM from Rails? xmpp4r-simple makes it really easy to talk to Jabber clients (such as Google Talk users) from Ruby, but it’s not quite a cut-and-dried solution for your Rails apps. Fortunately, there’s Jabberish. Jabberish is a DRb-backed Jabber client designed for use in multi-server Rails apps. Just drop in the [...]

site_config – painless custom configuration for your Rails project

site_config is a little plugin that addresses a problem lots of people seem to need to solve in their Rails apps: per-environment configuration variables. It’s very simple, but makes configuration dead-easy. To install it: script/plugin install git://github.com/cheald/site_config.git Once you have it installed, check out config/site_config.yml – there’s your config file. You’ll notice that it has [...]