以下の内容はhttps://blog.ebihara99999.com/entry/2024/11/26/000543より取得しました。


ActiveRecord::Reflection を読んだ

空いた時間に Rails コードリーディング。今日は ActiveRecord::Reflection をザーッと読んだ。

ActiveRecord::Reflection は model の関連付けに関するデータを保持するクラスという感じだった。例えば、belongs_to の実装では

def belongs_to(name, scope = nil, **options)
  reflection = Builder::BelongsTo.build(self, name, scope, options)
  Reflection.add_reflection self, name, reflection
end

のように add_reflection を呼んでいる。

細かいオブジェクトのふるまいを見たかったのだが、binding.irb を使うと

SyntaxError: /home/vscode/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/irb-1.13.0/lib/irb.rb:1600: syntax error, unexpected `end'

というエラーが出てしまうの、IRB の不具合だったりするのだろうか。全然ちゃんと調べてないけど地味に困っている。




以上の内容はhttps://blog.ebihara99999.com/entry/2024/11/26/000543より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14