代码改变世界

[QuickRoR]Ruby on Rails开发环境安装

2014-05-22 17:37  Benoly  阅读(167)  评论(0编辑  收藏  举报

1.Setup Ruby on Rails
2.Test Web App
3.Create the First Web App


1.Setup Ruby on Rails
1) Download rubyinstaller-1.9.3-p545.exe 'setup to C:\Ruby193\'
2) cmd check command: ruby -v 'return ruby 1.9.3p5p4'
3) Download DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe
4) Extract DevKit to path C:\Ruby193\DevKit
5) cd C:\Ruby193\DevKit
6) ruby dk.rb init
7) ruby dk.rb review
8) ruby dk.rb install
9) cmd : gem install rails
10) cmd : rails -v 'return rails 4.1.1'

2.Test Web App
1) cmd: rails new G:\Study\Ruby\demo1
2) create run.bat in G:\Study\Ruby\demo1 with content 'rails server', and run it , wait...
3) visit http://localhost:3000

3.Create the First Web App
1) cd G:\Study\Ruby\demo1
2) cmd rails g controller welcome '生成相关文件'
3) edit G:\Study\Ruby\demo1\app\controllers\welcome_controller.rb

1 class WelcomeController < ApplicationController
2   def say
3   end
4 end

4) create new 'say.html.erb' file in G:\Study\Ruby\demo1\app\views\welcome, and add html code,

1 <h1>Hello, World!</h1>

 5) edit G:\Study\Ruby\demo1\config\routes.rb

1 get "welcome/say" => "welcome#say"

6) visit 'http://localhost:3000/welcome/say'


enjoy Ruby on Rails...