editable_content_tag : The in_place_editor for Rails 2.0
The in_place_editor was a nifty helper in rails 1.2 days, but has been removed from 2.0. This is mostly due to the fact that it was obsoleted by REST. It also doesn’t play well with the new CSRF (Cross Site Request Forgery) prevention measures that are default in Rails 2.0.
REST takes Rails’ “Convention Over Configuration” mantra to a whole new level, so we can leverage that to create a new, more flexible, in_place_editor helper function that requires almost no controller modifications to work.
Like the original, editable_content_tag uses Scriptaculous’ Ajax.InPlaceEditor which, by default, doesn’t play well at all with Rails’ new rest scheme.
Posted in Ruby on Rails, Javascript | 11 comments |