ruby環境安裝草稿

來源:互聯網
上載者:User

標籤:

安裝 homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


brew search
brew install nginx

install rails under vpn
http://blog.csdn.net/xunyn/article/details/17069521
https://ruby-china.org/wiki/install_ruby_guide
http://stackoverflow.com/questions/15514865/brew-update-errors


install rvm
https://ruby-china.org/wiki/install_ruby_guide
install ruby under vpn
if ruby -v == 2.1.1
rvm system --default
else
rvm install 2.1.1 #under vpn
rvm 2.1.1 --default

bundle install # install all in gemfile

if error
brew install mysql
mysqld

 

cp database.yml.example database.yml
vim config/database.yml
rake db:create:all
rake db:migrate
rails s

rake -T| grep seed
執行所有seek命令.


rake assets:precompile RAILS_ENV=production

如果使用 system ruby 則 gem安裝於 ~/.gem檔案夾下面
如果使用 rvm安裝ruby 則 gem安裝於 ~/.rvm/.gem下面

rails也是一個gem


1. rails s 命令列可以展示每個請求的請求模組和profile資訊.

請求首頁. 首先訪問: routes.rb

root ‘home#index‘
resources :roles

路由至: home_controller.rb

skip_before_filter :authenticate_user! // 跳過使用者認證
skip_authorization_check// 跳過使用者認證
before_action :redirect_to_login_if_in_subdomain // 如果是次層網域, 跳轉到登陸介面

def index
end

index函數為空白, 直接尋找 views/layouts/home.html.erb -> views/home

不同action 根據action 來做一些樣式的改變.


http://localhost:3000/login

請求登陸介面: routes.rb

get "/login" => "sessions#new"

devise.sessions_controller

prepend_before_filter :require_no_authentication, only: [ :new, :create ]
prepend_before_filter :allow_params_authentication!, only: :create
prepend_before_filter only: [ :create, :destroy ] { request.env["devise.skip_timeout"] = true }

# GET /resource/sign_in
def new
self.resource = resource_class.new(sign_in_params)
clean_up_passwords(resource)
respond_with(resource, serialize_options(resource))
end

ruby環境安裝草稿

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.