sql
sql copied to clipboard
Merge joined model instances with preloaded direct references
post = Post.where(id: 1).join(:author) { |x| x.select(:id, :name) }
pp post # <Post @author=<User @id=42 @name="John"> @content="...">
Should work without :id.