便利なレポジトリ
1章
ヘロクのコマンド:rename
$ heroku rename railstutorial
ヘロクへのデプロイ
pgのエラーが出る
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.0.0
remote: -----> Installing dependencies using 1.7.12
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Some gems seem to be missing from your vendor/cache directory.
remote: Could not find pg-0.15.1 in any of the sources
remote: Bundler Output: Some gems seem to be missing from your vendor/cache directory.
remote: Could not find pg-0.15.1 in any of the sources
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
vendor/cacheのところで何か悪さしてるから、以下のコマンドを実行。
lang:command
$ rm -r vendor/cache
もう一度、
lang:command
$ git push heroku master
で解決!
3章
nokogiriのインストールでエラー
An error occurred while installing nokogiri (1.6.6.2), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.6.2'` succeeds before bundling.
解決策:
http://qiita.com/suu_g/items/fcf549e16c797a9d7dc0
もしくは単純にXcode Command Line Toolsをインストールしていないだけ。
The file "/usr/include/iconv.h" is missing in your build environment,
which means you haven't installed Xcode Command Line Tools properly.
To install Command Line Tools, try running `xcode-select --install` on
terminal and follow the instructions. If it fails, open Xcode.app,
select from the menu "Xcode" - "Open Developer Tool" - "More Developer
Tools" to open the developer site, download the installer for your OS
version and run it.
この時はターミナルで下記を実行。
$ xcode-select --install
元に戻る方法
- controllerやmodel
$ rails generate controller FooBars baz quux
$ rails destroy controller FooBars baz quux
- マイグレーション
$ rake db:migrate
$ rake db:rollback
$ rake db:migrate VERSION=0