In the previous essay Ruby on Rails development from scratch (Windows) (ii)-Create project and first Hello World, we described how to use instantrails to create a project and write a simple HelloWorld page, Today on the basis of the last, write a simple page jump.
1. Change the contents of the Say_controller.rb file in the Appcontrollers directory to the following:
Class Saycontroller < Applicationcontroller
def Hello
@time = Time.now
end
def G Oodby
End
We see that compared to the contents of the previous essay, we have added:
def goodby
end
2. Modify the contents of the hello.rhtml under the Appviewssay directory:
<html>
<p>
Say <a href="/say/goodbye">GoodBye</a>!
</p>
</html>
3. Below we will create a goodbye.rhtml file in the Appviewssay directory, which reads as follows:
<html>
<head>
<title>See You Later!</title>
</head>
<body>
<h1>Goodbye!</h1>
<p>
It was nice having you here.</p>
</body>
</html>