A tutorial on eager loading polymorphic associations with Ruby on Rails avoiding "n-plus-one" queries.
![Eager Loading Polymorphic Associations with Ruby on Rails](https://cdn-ak-scissors.b.st-hatena.com/image/square/71492a421934ebffe638da2f00aa0893feda83cf/height=288;version=1;width=512/https%3A%2F%2Fksylvest.com%2Fassets%2Fprofile%2Fdefault-5babf7464197c2c9ae8d4e9333d375de59ba03fb25f109e11d6f7e9ea39858bb.jpg)
まずはこれを見て欲しい # == Schema Information # # Table name: users # # id :integer not null, primary key # name :string(255) # class User < ActiveRecord::Base has_many :articles, dependent: :destroy after_create do articles.import(%w"1 2 3 4 5".map{|text| Article.new(text:text)}) end before_destroy do p articles.map(&:text) end end # == Schema Information # # Table name: articles # # id :integer not null,
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く