Ruby on Rails -- create a basic ror Application

Source: Internet
Author: User
Tags ruby on rails

Preface

Today, when giving a lecture, Mr. Jiang talked about the development concept of Ruby on Rails, that is, happy programming. It is a pleasure to write code.

In the world of study, I don't feel how happy I am. I just don't have to go to work. Instead, I sat in the conference room and listened to my teacher's lectures. I felt a lot easier at once.

Let's get down to the point and start our Ruby on Rails journey.

Create an application named demo

1. Start instantrails.exe first, right-click the task box and right-click it to go to the open Ruby Console window. This shows a cmd interface, as shown in:

2. First, we use the rails command to create a new application named demo. In the above interface, enter: rails demo, the system automatically creates a demo folder under the rails_apps folder under the installation path of instantrails and creates a series of default files in its folder. In this way, the demo application is successfully created.

3. Next we need to create a hello method for the say control process to display the page. First, we need to connect to the demo folder and input: CD demo in the command line.

At this time, the path has been directed to the demo folder, and the command: Ruby script/generate controller say hello

As shown in (yellow area in the figure ):

 

 

In this case, we started the demoapplication service to display the content in hello.html, and typed the following in the command line: Ruby script/server.

5. After the demo application is started successfully, you can enter http: // localhost: 3000/say/hello in the browser to successfully access our application, as shown in:

6. Now the demo application can run.

7. We can modify it (Path: demo \ app \ views \ say \ hello.html. ERB)

For example, modify to: Hello, world! It is Ruby on Rails! Save and refresh the browser again. The displayed content changes:

Ror advocates to run it first ~ So far, our hello is available.

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.