简体   繁体   中英

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 :

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.

render :js => "window.location = #{escape_javascript(request.env['HTTP_REFERER'])}"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM