/jeditable-rails

a gem to add in-place-editable fields to your Rails project

Primary LanguageRubyMIT LicenseMIT

jeditable-rails Build Status

A gem to add in-place-editable fields to your Rails project. It is a wrapper for the Jeditable jQuery plugin, so most options for $.editable() can be passed through the options parameter of the helpers.

Requirements

Usage

Assuming a Rails 3 project, in your Gemfile, add:

gem 'jeditable-rails'

Suppose you have a User model with a #zip_code attribute.

# app/views/users/show.html.erb
<h1>View/Edit your profile</h1>
...
<b>Zip Code:</b>
<%= editable_field @user, :zip_code %>

The helpers can be used in any view you like. The field appears as normal text to the user, but when clicked, turns into a form field that will then be submitted back to the server. By default, jeditable-rails requires an update action when a PUT is done to url_for(object), which is generated by default for Rails scaffolds.

Copyright

Copyright (c) 2011 Aidan Feldman. See LICENSE.txt for further details.