rakeの中でrvmを使用したい
#!/bin/bash if [ -f /etc/profile.d/rvm.sh ] then source /etc/profile.d/rvm.sh else echo '$0: /etc/profile.d/rvm.sh not found' exit 1 fi
Railsでlogを書きだす場所を変更する。
time = Time.now.strftime "%Y%m%d" file_name = time + "test.log" ActiveRecord::Base.logger = Logger.new("/var/log/test/"+file_name)
View-based Applicationが見つからない。
View-based Applicationが見つからない。
「View-based Application」と同じ構成にするには、「Single View Application」を選択し、「Next」ボタンを押し、「Use storyboard」のチェックを外し「Next」ボタンを押し保存するれば同じ構成になっているようです。
sudo heroku keys addの際に出たエラー
/usr/local/heroku/vendor/gems/rest-client-1.6.1/lib/restclient.rb:9:in `rescue in
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient.rb:9: no such file to load -- net/https. Try running apt-get install libopenssl-ruby (LoadError)
sudo apt-get install openssl sudo apt-get install libssl-dev
cd /usr/local/src/ruby-1.9.2-p0/ext/openssl/ sudo ruby extconf.rb sudo make sudo make install
sudo apt-get install libreadline-dev cd /usr/local/src/ruby-1.9.2-p0/ext/readline/ sudo ruby extconf.rb sudo make sudo make install
ssh-keygen -C "hoge@hoge.com" -t rsa
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
sudo heroku keys:add /home/joji/.ssh/id_rsa.pub
herokuでaddonを管理
addonの一覧を見る
heroku addons
addonを追加
heroku addons:add newrelic:standard
addonを削除
heroku addons:remove newrelic:standard
addonをアップグレード
heroku addons:upgrade newrelic:professional
Railsでtinyintを数字として認識したい。
railsでMySQLをActiveRecordを通して使うとtinyintが勝手にboolean型になって困った。
元々がRailsを意識していないdatabaseだったです。
カラム名_code_before_type_cast
としたらtinyint型のを数字として扱えました。
ActiveRecord::ConnectionAdapters::MysqlAdapter.emulate_booleans = false
これを記述しても大丈夫みたいですが、errorが出るので今回は止めました;