Skip to content

Instantly share code, notes, and snippets.

@akiomik
Last active December 29, 2015 19:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save akiomik/7715067 to your computer and use it in GitHub Desktop.
rails環境構築メモ
brew install rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .bashrc
echo 'eval "$(rbenv init -)"' >> .bashrc

git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install -l # 入れれるバージョン
rbenv install 2.0.0-rc2
rbenv versions # バージョン確認
rbenv global 2.0.0-rc2 # rc2を適用
ruby -v # バージョン確認
sudo gem install rails
@akiomik
Copy link
Author

akiomik commented Nov 30, 2013

@akiomik
Copy link
Author

akiomik commented Nov 30, 2013

@akiomik
Copy link
Author

akiomik commented Nov 30, 2013

@akiomik
Copy link
Author

akiomik commented Nov 30, 2013

@akiomik
Copy link
Author

akiomik commented Nov 30, 2013

controllerのscaffold作成

# rails g controller :name :method
rails g controller top index

http://ayaketan.hatenablog.com/entry/2012/12/19/210150

@akiomik
Copy link
Author

akiomik commented Nov 30, 2013

@akiomik
Copy link
Author

akiomik commented Nov 30, 2013

@akiomik
Copy link
Author

akiomik commented Nov 30, 2013

@akiomik
Copy link
Author

akiomik commented Dec 1, 2013

railsコマンドとrakeコマンド。
http://railsdoc.com/rails
http://railsdoc.com/rake

@akiomik
Copy link
Author

akiomik commented Dec 8, 2013

@akiomik
Copy link
Author

akiomik commented Dec 15, 2013

module => trait, include => extends, with, prepend => (structural subtyping)
class => class, < => extends

メソッド探索はprepend => class => include => super classという感じ
prependはメソッド名衝突時に前に処理を付与するが、includeは衝突時に上書き

@akiomik
Copy link
Author

akiomik commented Feb 3, 2014

gem i spring

spring rake ...spring g ...などとすることでコマンドの起動が速くなる

@akiomik
Copy link
Author

akiomik commented Feb 4, 2014

@akiomik
Copy link
Author

akiomik commented Feb 4, 2014

mysql対応

最初に指定する場合

rails new hoge --database mysql

後から変更する場合

  1. config/database.ymlを編集

    development:
    adapter: mysql2
    database: hogehoge
    encoding: utf8
    pool: 5
    reconnect: false
    username: hoge
    password: fuga
    host: localhost
    port: 3306
  2. コマンドを実行

    bundle install
    spring rake db:migrate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment