Rails 新人起步走
-
Upload
- -
Category
Technology
-
view
459 -
download
2
Transcript of Rails 新人起步走
Ruby
✤ Ruby is … !
✤ Ruby的作者--松本⾏行弘!
✤ http://www.ruby-lang.org/zh_tw/!
✤ 最新版本: 2.1.0!
✤ 使⽤用 IRB 練習!
✤ Mac 及 Linux -> 在 terminal 直接輸入 irb
homebrew
✤ 套件管理⼯工具!
✤ http://brew.sh/!
✤ install ⽅方式!
✤ sudo ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)”!
✤ brew !
✤ P.S 必須有xcode套件
RVM(ruby version manager)
✤ RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems. !
✤ http://rvm.io/!
✤ https://rvm.io/rvm/install!
✤ install ⽅方式!
✤ \curl -sSL https://get.rvm.io | bash -s stable —ruby!
✤ 設定版本!
✤ rvm use ruby-2.0.0 --default
Ruby Gem
✤ RubyGems 是 Ruby 的 Package 管理系統,讓你輕易安裝及管理各種 Ruby programs/libraries。︒!
✤ gem -v RubyGems 的版本!
✤ gem update --system 升級你的RubyGems版本!
✤ gem install gemname 安裝某個套件!
✤ gem list 列出安裝的套件!
✤ gem list -r keyword 列出 RubyGems.org 上有此關鍵字的套件(可⽤用regular expression)
Rails 指令
✤ rails new project !
✤ rails console (rails c)!
✤ rails server (rails s)!
✤ rails generate (rails g)
create CRUD
✤ step 3 : rails server!
✤ step 4: http://localhost:3000/posts
Pow v.s Powder
Pow 是 37 Signals 開發出來的⼀一個很棒的東西,讓你檢視⾃自⼰己的開發進度時不需要⽤用 http://localhost:3000 這種需要 port number 的網址,可以⽤用 http://blog.dev 這樣的網址。︒
⽽而 Pow 也是⼀一個 Webserver , 好處如下:
1. 可以使⽤用 http://groupmy.dev 這種網址掛起網站,⽽而非使⽤用 rails s 跑在 port 3000。︒
2. 修改時,可以在不終⽌止 server 的情況下,去 reload server
相關資源
✤ http://ihower.tw/rails2/!
✤ http://ihower.tw/git/!
✤ https://www.codeschool.com/courses/git-real!
✤ http://www.ruby-lang.org/zh_tw/documentation/!
✤ http://ruby.railstutorial.org/chapters/a-demo-app!
✤ http://hechien.logdown.com/posts/2013/10/08/working-with-rails-02