Skip to content
Browse files

Updated README with controller code documentation mentioned in Issue #9

  • Loading branch information...
1 parent 98f757b commit 7ae436c423b577bd1db476d9af2b25d6b1f4b43e August committed
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 7ae436c

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