【发布时间】:2012-12-15 15:46:28
【问题描述】:
我在 _form.html.erb 中添加了 :remote => true ,现在想知道如何获取它,以便当用户保存页面上的内容时,它会保存并发出通知。
在我的documents_controller.rb中,我有;
def create
@document = current_user.documents.build(params[:document])
if @document.save
redirect_to @document.edit, notice: 'Saved'
else
render action: "new"
end
end
def update
@document = current_user.documents.find_by_url_id(params[:id])
if @document.update_attributes(params[:document])
redirect_to @document, notice: 'Saved'
else
render action: "edit"
end
end
【问题讨论】:
标签: javascript ruby-on-rails ruby ajax