Ruby学习笔记3:Rendering(渲染)和 Redirect(重定向)
1. Rendering Rendering 是特别要告诉Controller 中的methods,要哪个view file来显示给用户。We can show Views as we wish! Earlier each one of our Views rendered based on the method specified in the Controller. If we write the following method: def render_demo end Rails will always look for the render_demo View. But if we write: def render_demo render :home end We can tell Rails to render the home View, as long as we have one. Rendering just tells Rails to show the View we specify. 这里这个例子是这样的:
…