2017-02-01から1ヶ月間の記事一覧

ActiveRecordを使って生sqlを書く場合

Base.connection.select_all あたりは細かく知りたい hash = ActiveRecord::Base.connection.select_all("select sum(sub1.diff) from (select diff from differences order by created_at desc limit 5) sub1").to_hash puts hash[0]["diff"]

Herokuでrails runner が実行されない

local の develop 環境では動いているがheroku(production)では実行されない 結論 Rails5 では production 環境の autoload で lib を対象としない application.rb に eager_load を指定し、lib を対象とするようにした 参考にさせて頂きました やろうとして…

Heroku で bin/rails: No such file or directory

こんな事にハマる人はどこにも居ないと思うが、いつかの自分の為に。 結論 ~/.gitignore に /bin/ の記載があり、/bin 以下のファイルがheroku に push されていなかった HerokuでRailsを起動したら Application error An error occurred in the application…