redirect_to :action => :index
需要跳转到index这个action,然后渲染index.html.erb,额外增加了一次http请求。直接render "index", :alert => 'Your book was not found!'
就把额外的这次请求给免了
render是服务器直接给你页面。
redirect_to是服务器给浏览器地址,浏览器再次请求服务器给自己的哪个地址,跳转。
render是渲染模板
redirect_to是跳转,也就是发送新的请求到某Action