[英]Replace render :update for rails 3.1
It seems that the method render :update is not supported anymore in Rails 3.1, now I'm checking what the best way is to change this code : 在Rails 3.1中似乎不再支持render:update方法,现在我正在检查更改此代码的最佳方法:
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
I just need to do a redirect :back when the action is succesful, but for the moment he just try to render the update partial. 当操作成功时,我只需要执行redirect:back,但是目前他只是尝试部分呈现更新。
render :js => "window.location = #{escape_javascript(request.env['HTTP_REFERER'])}"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.