Turbolinks + HTTP Redirectの注意

「公式ドキュメントにちゃんと書いてある + 考えてみれば当たり前」なのだが、今日数分消費してしまったのでメモ。

TL; DR

  • Turbolinks-Location HTTPヘッダを出力しよう
    • turbolinks gemを使ってる場合は勝手にやってくれるよ
  • これがないと、RedirectしたときにブラウザのURL欄がリダイレクト先に変わってくれないよ
続きを読む

ActiveSupport::MessageEncryptorを慎重に使う

経緯

Rubyを2.3系から2.4.1に上げたら、ActiveSupport::MessageEncryptorを使っているところが壊れた。ちなみにRailsは5.0.1。

key must be 32 bytes
/Users/nisshiee/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.1/lib/active_support/message_encryptor.rb:79:in `key='
/Users/nisshiee/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.1/lib/active_support/message_encryptor.rb:79:in `_encrypt'
/Users/nisshiee/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.1/lib/active_support/message_encryptor.rb:60:in `encrypt_and_sign'
...
続きを読む

Rubyの便利スクリプトをRustで書き直した

nisshiee.hatenablog.jp

昨日↑便利スクリプトRubyで書いた話をしたのだが、これ、毎日使っていると、0.1秒とか0.2秒(体感)待たされるのが、気になってくるんだよね。

というわけで、Rustで書き直した。

github.com

続きを読む