Announcing JIPE: RESTful In-Place Editors for Rails
Hi, everyone! I thought I’d take some time in-between my Journey 2.5 feature tour posts to talk about one of the components I wrote for the Journey 2.0 release: JIPE, or Jester In-Place Editors.
In more concrete terms: Ruby on Rails, since version 1.2 or so, makes it very easy to write RESTful data objects. Ruby on Rails also used to have a nice helper method called in_place_editor, which let you do a neat trick: basically, you could show some information on your web page about an object, and have the user be able to edit it right there on the same page.
As an example, let’s say you’re looking at a blog post, and the web page shows you the post’s title, author, and date. You want to edit the title of the post, because you misspelled a word. With in_place_editor, you could just click on the title, and it would turn into a text field, which you could then edit, and your changes would be instantly applied! Nifty, eh?
Unfortunately, RESTful resources break all this, and the Rails team decided that in_place_editor belonged in a plugin anyway (and they were probably right). Writing a new version of in_place_editor that used REST would have been possible, but kind of a pain.
I won’t go into the full details of how you use JIPE here – you can find that out in the README file. But just to give you a flavor of it, here’s a JIPE-based editing view for a hypothetical blog post:
Title: <%= jipe_editor_for @post, :title %><br/> Author: <%= jipe_editor_for @post, :author %><br/> <%= jipe_editor_for @post, :body, :rows => 5 %>
To install JIPE in your Rails app, do this:
script/plugin install http://ae-rails-plugins.googlecode.com/svn/trunk/jipe/
Thanks, folks! If you have any questions, comments, suggestions, etc., comment on this post or email me!