支持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 = P ost.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 # 视图 # 带参数的即时编辑 'textarea', :textarea_cols => 25, :textarea_rows => 10}%> 'textarea', :textarea_rows => 10}%> ost.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 # 视图 # 带参数的即时编辑 'textarea', :textarea_cols => 25, :textarea_rows => 10}%> 'textarea', :textarea_rows => 10}%>