2018-05-01から1ヶ月間の記事一覧

developmentでridgepole applyしたときにtest DBもつくる

Rails標準のMigrationを使う場合はdevelopmentのDBをアップデートしたらschema.rbが更新されてspec/rails_helper.rbとかに書いてある ActiveRecord::Migration.maintain_test_schema! っていうのでrspec実行前にtest DBをmigrationしてくれる。 ridgepoleを…

ruby 2.5で変更されたtoplevel constant lookupの挙動

こういうコードがあったとして class Foo; end class Bar; end p Foo::Bar #=> Bar ruby 2.4まではwarning: toplevel constant Bar referenced by Foo::Bar を出しつつFoo::BarはBarを返す。 これはrubyの定数探索が継承関係を遡って探すという仕様と、トッ…

ngrepでリクエストだけ出力する

ngrepで3000番ポートに対する通信を見る場合こんな感じで見れるけど $ sudo ngrep -W byline -q -d any port 3000 レスポンスはいらないのでリクエストだけみたい、という場合はdst portにすればよい。 $ sudo ngrep -W byline -q -d any '' dst port 3000 '…

RailsのAPI onlyでOmniAuthがエラる

RailsのAPI onlyのアプリケーションだとセッションが無効化されているのでOmniAuthを使おうとするとOmniAuth::NoSessionErrorで落ちる。 READMEに書いてあった。 https://github.com/omniauth/omniauth/blob/650943c16de33c7cdf16708b74766e95ad369610/READM…