Ruby on Rails development from scratch (Windows) (iii)-enable jumps between pages

Source: Internet
Author: User
Tags ruby on rails

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>


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.