ajax in place editing with rails 2.1 and jquery

Picture 1.png

Install jrails and jrails_in_place_editing

1 script/plugin install git://github.com/aaronchi/jrails.git
      2 script/plugin install git://github.com/rakuto/jrails_in_place_editing.git
      

Setup jrails in application.html.erb

1 <head>
      2         <%= javascript_include_tag :defaults %>
      3 </head>
      4 

Restart your server

Setup jrails_in_place_editing in the..

1. ..Controller

1 class ProjectsController < ApplicationController
      2   in_place_edit_for :project, :acreage
      3   ...
      4 end
      

1 class ProjectsController < ApplicationController
2 in_place_edit_for :project, :acreage
3
4 end

2. ..View

1   <%= in_place_editor_field :project, :acreage %>
      2 

1   <%= in_place_editor_field :project, :acreage %>
2

That’s it. For more on customization and additional options check out the jrails_in_place_editing readme at:

Picture of Scott Motte

delicious facebook rss twitter

Spitfire Sky | github | archives | resume