File: //usr/local/rvm/gems/ruby-2.5.9/doc/activerecord-6.1.4.1/ri/ActiveRecord/SpawnMethods/merge-i.ri
U:RDoc::AnyMethod[iI"
merge:ETI"%ActiveRecord::SpawnMethods#merge;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"cMerges in the conditions from <tt>other</tt>, if <tt>other</tt> is an ActiveRecord::Relation. ;TI"{Returns an array representing the intersection of the resulting records with <tt>other</tt>, if <tt>other</tt> is an array.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"VPost.where(published: true).joins(:comments).merge( Comment.where(spam: false) )
;TI"@# Performs a single join query with both where conditions.
;TI"
;TI";recent_posts = Post.order('created_at DESC').first(5)
;TI"5Post.where(published: true).merge(recent_posts)
;TI"_# Returns the intersection of all published posts with the 5 most recently created posts.
;TI"V# (This is just an example. You'd probably want to do this with a single query!)
;T:@format0o;
; [I"&Procs will be evaluated by merge:;T@o;; [I"@Post.where(published: true).merge(-> { joins(:comments) })
;TI"7# => Post.where(published: true).joins(:comments)
;T;
0o;
; [I"YThis is mainly intended for sharing common conditions between multiple associations.;T:
@fileI"0lib/active_record/relation/spawn_methods.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(other, *rest);T@#FI"SpawnMethods;TcRDoc::NormalModule00