A Rails HOWTO: Simplify In-Place Editing with Script.aculo.us
Did Drew McLellan’s “Edit-in-place with Ajax” article over at 24 ways catch your eye, only to make you throw up in your mouth a little when you saw the PHP code? God, me too. One second, basking in the glow of Web 2.0 goodness, the next, assaulted by a total lack of distinction between model, view, and controller. Gaw.
But stil, in-place editing is sweet. Flickr makes good use of it, and it’s an example we should take note of. They don’t use it exclusively, but rather as a solution to the edit/show dichotomy (an unfortunate side effect of Rails scaffolding). Now, implementing this subtle magic in your application is easy as hell (as Drew’s article shows), but we’re Rails freaks. We hold ourselves to a higher standard. Here’s how to get your in-place edit on without mucking about with too much Javascript, using an awesome helper method I’ve cooked up.
54 comments »