配置Ruby & ROR

1. 從http://rubyinstaller.org/downloads/下載ruby, 我們使用1.9作爲例子

2. 同時,下載對應的devkit,這裏是

  • Ruby 1.8.6 to 1.9.3: tdm-32-4.5.2
  • Ruby 2.0.0: mingw64-32-4.7.2
  • Ruby 2.0.0 x64 (64bits): mingw64-64-4.7.2

2. 安裝ruby結束後,解壓devkit,進入目錄運行ruby dk.rb install

http://stackoverflow.com/questions/17499946/rails-installtion-error-the-atomic-native-gem-requires-installed-build-tools

解決atomic安裝失敗的方法

http://stefanuswiely.blogspot.com/

:\> REG DELETE "HKCU\Software\Microsoft\Command Processor" /v AutoRun


3. 之後使用gem install rails就可以了


4. 如果希望使用ri, 而又碰到了沒有的情況,follow以下步驟

gem install rdoc-data
# Regenerate system docs
rdoc-data --install
# Regenerate all gem docs
gem rdoc --all --overwrite
# Regenerate specific gem doc with specific version, optional
gem rdoc gemname -v 1.2.3 --overwrite


5.使用open shift 部署ror

http://www.lovelucy.info/redhat-openshift-trial-review.html

http://www.nishizhen.cn/2012/01/%E5%9C%A8openshift%E4%B8%AD%E9%83%A8%E7%BD%B2ror%E5%BA%94%E7%94%A8/


6. 使用Heroku部署

http://chunchu.org/code/2012/03/31/2004.html

http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec-rails_server

https://dashboard.heroku.com/apps

https://devcenter.heroku.com/categories/ruby

https://devcenter.heroku.com/articles/getting-started-with-rails4


常見問題:

Add 'gem sqlite3'' to your Gemfile

http://stackoverflow.com/questions/6853046/error-installing-sqlite3-gem-via-bundler

https://www.ruby-forum.com/topic/4415126

cant-push-app-heroku-failed-to-install-gems-via-bundler

http://stackoverflow.com/questions/9009278/cant-push-app-heroku-failed-to-install-gems-via-bundler

undefined-method-visit-when-using-rspec-and-capybara-in-rails

http://stackoverflow.com/questions/15148585/undefined-method-visit-when-using-rspec-and-capybara-in-rails

push 代碼到Heroku

http://ruby-china.org/topics/10813

Fix installation issue of bcrypt-ruby
http://stackoverflow.com/questions/18541062/issues-using-bcrypt-3-0-1-with-ruby2-0-on-windows

Fix dropdown menu not works issue(8.25)

http://stackoverflow.com/questions/10218587/twitter-bootstrap-drop-down-suddenly-not-working


7.不錯的教程

http://railstutorial-china.org/

http://guides.rubyonrails.org/

http://ruby.railstutorial.org/ruby-on-rails-tutorial-book


8. 弄懂routes

http://guides.ruby-china.org/routing.html
http://www.cnblogs.com/lwm-1988/archive/2011/09/13/2174686.html<不是很好,抄襲部分佔多,講解不夠詳細>


9. MarkDown page

http://daringfireball.net/projects/markdown/

https://help.github.com/articles/github-flavored-markdown

http://stackoverflow.com/questions/10240125/working-with-readme-md-on-github-com


Ext. How to learn ROR

http://edwinmeyer.com/Integrated_RHG.html
先搞懂Rails的路由模式
posts GET /posts(.:format) {:controller= > "posts", :action= > "index"}
POST /posts(.:format) {:controller= > "posts", :action= > "create"}
new_post GET /posts/new(.:format) {:controller= > "posts", :action= > "new"}
edit_post GET /posts/:id/edit(.:format) {:controller= > "posts", :action= > "edit"}
post GET /posts/:id(.:format) {:controller= > "posts", :action= > "show"}
PUT /posts/:id(.:format) {:controller= > "posts", :action= > "update"}
DELETE /posts/:id(.:format) {:controller= > "posts", :action= > "destroy"}
通過rake routes你可以得到類似上面的路由記錄,這樣你就明白rails是如何通過路由來調用MVC裏的C-controller裏的方法了;然後再看看MVC裏的M-model還有數據庫遷移部分,剩下就是V-view了,重點是如何和javascript打交道的,Rails3和之前的版本都有不同。完成了這些就算入門了,然後就是逛github和http://railsplugins.org這樣的網站,瞭解下各個方面的插件。ps: Bundler實在是很方便。


10. bootstrap for rails

http://railsapps.github.io/twitter-bootstrap-rails.html

https://tutorials.railsapps.org/rails-bootstrap


11. 安裝配置MySQL

Follow下面這篇文章。基本上是需要安裝一個MySQL Connector

然後把幾個對應的.dll文件拷貝到ruby對應的lib目錄下

http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/


12 Ruby on windows

http://rubyonwindowsguides.github.io/book/ch04-01.html


http://stackoverflow.com/questions/8200066/error-installing-mysql2-with-windows-7-x64-does-not-work

If not works, then you have to choose proper version of MySQL and Ruby (including system arch version)

http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/

To be resolved:

1. How to make bootstrap work in Rails app on Heroku could service?? Downgrade?

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章