安装配置
rvm ruby ..
RVM安装ruby
查看安装的ruby1
rvm list
安装指定版本ruby1
rvm install ruby 2.2.2
使用制定版本ruby1
rvm use 2.2.2
gem源更换
查看所有gem
源1
$ gem sources -l
移除一个gem
源1
$ gem sources --remove https://rubygems.org/
添加一个gem
源1
$ gem source -a https://gems.ruby-china.org
安装rails
gem安装rails
1
$ gem install rails -v 4.2.3
rails
创建项目1
$ rails new [myPro] [--skip-bundle]
路由配置
eg:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20# 手动配置posts的show路由 as配置路由名称
# get 'posts/:id', :to => 'posts#show', :as => 'show_post'
# 排除show路由
# resources :posts, :except => :show
resources :posts do
# posts/recent
# get 'recent', :on => :collection
# 集合路由
collection do
# posts/recent
get 'recent'
end
# 成员路由
member do
# posts/:id/recent
get 'recent'
end
end