Skip to content
Browse files

Merge pull request #14 from augustf/patch-1

Updated README with controller code documentation mentioned in Issue #9
  • Loading branch information...
2 parents 98f757b + 7ae436c commit 03e60914bb589196287d56f367eed92126693b07 @afeld committed Jan 1, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 README.md
View
9 README.md
@@ -20,6 +20,15 @@ Suppose you have a `User` model with a `#zip_code` attribute.
...
<b>Zip Code:</b>
<%= editable_field @user, :zip_code %>
+
+ #app/controllers/users_controller.rb
+ format.html {
+ if request.xhr?
+ render :text => params[:user].values.first
+ else
+ redirect_to(@user, :notice => 'User was successfully updated.')
+ end
+ }
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.

0 comments on commit 03e6091

Please sign in to comment.
Something went wrong with that request. Please try again.