Edit in place for jRails.
支持JQuery的Edit In Place Rails插件(rakuto),使用简便轻巧,与大家共享。 例子 ======= # 控制器 class BlogController < ApplicationController in_place_edit_for :post, :title end # Customize the action that update the value class BlogController < ApplicationController # set_#{object}_#{title} def set_post_title post = Post.find(params[:id]) post.title = params[:value] # Name of parameter is always 'value'. post.save # It should render a text render :text => post.title end end # 视图 <%= in_place_editor_field :post, :title %> # 带参数的即时编辑 <%= in_place_editor_field :post, :title, {}, {:field_type => 'textarea', :textarea_cols => 25, :textarea_rows => 10}%> <%= in_place_editor_field :post, :title, {}, {:field_type => 'textarea', :textarea_rows => 10}%>