Upgrade to Pro — share decks privately, control downloads, hide ads and more …

【しくじり先生】 RailsのAutoloadingとReloadingの仕組みとやってしまったバグ

Avatar for Yuta Fujii Yuta Fujii
August 27, 2021

【しくじり先生】 RailsのAutoloadingとReloadingの仕組みとやってしまったバグ

Avatar for Yuta Fujii

Yuta Fujii

August 27, 2021
Tweet

More Decks by Yuta Fujii

Other Decks in Programming

Transcript

  1. @__yutafujii__ 開発環境サーバーのレスポンス 受理 routing controller 特定 処理 module Admin class

    BooksTagsController def create @tagging = BookTag.new # … end end end Classic
  2. @__yutafujii__ 開発環境サーバーのレスポンス 受理 routing controller 特定 処理 module Admin class

    BooksTagsController def create @tagging = BookTag.new # … end end end const_missing発火 Classic
  3. @__yutafujii__ リクエストが同時に飛んでくると 受理 routing controller 特定 処理 レスポンス const_missing Autoloading(1)

    Classic remove_const(1) 受理 routing controller 特定 処理 レスポンス const_missing Autoloading(2) remove_const(2)
  4. @__yutafujii__ 実際に起きていたこと GET /api/books GET /api/tags Vueインスタンス created() controller 特定

    controller 特定 Subdomain::Api::BooksController Subdomain::Api::TagsController