似乎方法渲染:Rails 3.1中不再支持更新,现在我正在检查更改此代码的最佳方法:
def create
@address = @current_user.addresses.build(params[:address])
@address.save!
respond_to do |accepts|
accepts.html {
flash[:notice] = t(:"notices.address.created")
redirect_to :back
}
accepts.js {
flash[:notice] = t(:"notices.address.created")
render :update do |page|
page.redirect_to(:back)
end
}
end
end
我只需要进行重定向:当动作成功时返回,但目前他只是尝试将更新部分渲染。
答案 0 :(得分:1)
render :js => "window.location = #{escape_javascript(request.env['HTTP_REFERER'])}"