Enter Ruby on Rails world

Source: Internet
Author: User
Tags web services ruby on rails

Introduction to Ruby and Rails

Ruby is an object-oriented, dynamic scripting language. Its syntax is flexible and provides a rich library of classes. Therefore, the efficiency of writing programs in Ruby is very high.

Although Ruby was very early (born in Japan in 1993), Ruby has always lacked English documentation and Ruby was not very good at web development. So before 2000, Ruby was only popular in Japan. But all this was broken by rails, which came out in 2000.

Rails is a framework that is written using pure ruby. It provides strong support for web development, such as support for data mapping, MVC patterns, Web Services, security, and more. And these functions are much easier to operate than similar products, such as the MVC pattern, which is easier to use than struts. In addition to these, rails can also automatically generate Web programs based on templates. This will save us a lot of time. Before discussing how Ruby can quickly develop web programs with rails, let's look at how to install and run Ruby and rails.

Installing and running Ruby

Ruby supports multiple operating system platforms that currently support Windows, Linux, and Os X, and can download Ruby's installer and source code from Ruby's official website: http://www.ruby-lang.org/en/downloads/.

Under Windows for easy installation, it is recommended that you download the installed version of Ruby. After installation, there are two executable files in the bin directory in the Ruby installation directory: Ruby.exe and Rubyw.exe. The first one will start a console run Ruby program, and the second does not start the console running Ruby program. Let's start by writing a simple ruby program!

Build a text file: first_ruby.rb

Enter a ruby statement:

Puts Time.now.strftime ("%y-%m-%d%h:%m:%s")

Perform Ruby first_ruby.rb

If you output a string similar to "2006-10-07 19:20:20", Ruby is already installed successfully.

Note: Ruby has an eclipse plug-in that's pretty good, and if it's interesting, you can use Eclipse's Help->software updates->find and install functionality to pass through http:// Updatesite.rubypeople.org/release for installation.

Installing and running Rails

Rails is easy to install under Windows, simply by executing the following command:

Gem Install Rails--include-dependencies.

Note: The gem command is in the current bin directory of Ruby installation and the path path is set at run time. There is also the need to connect to the Internet when executing this command. Because this command is downloaded from rails and installed over the Internet.

After you install rails. Execute the following command

Rails first_rails
cd first_rails
Ruby Script/server

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.