File: //usr/local/rvm/gems/default/doc/activerecord-6.1.4.1/ri/ActiveRecord/QueryMethods/unscope-i.ri
U:RDoc::AnyMethod[iI"unscope:ETI"'ActiveRecord::QueryMethods#unscope;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"SRemoves an unwanted relation that is already defined on a chain of relations. ;TI"NThis is useful when passing around chains of relations and would like to ;TI"Bmodify the relations without reconstructing the entire chain.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I":User.order('email DESC').unscope(:order) == User.all
;T:@format0o;
; [I"SThe method arguments are symbols which correspond to the names of the methods ;TI"Xwhich should be unscoped. The valid arguments are given in VALID_UNSCOPING_VALUES. ;TI"HThe method can also be called with multiple arguments. For example:;T@o;; [I"?User.order('email DESC').select('id').where(name: "John")
;TI"7 .unscope(:order, :select, :where) == User.all
;T;
0o;
; [I"ZOne can additionally pass a hash as an argument to unscope specific +:where+ values. ;TI"TThis is done by passing a hash with a single key-value pair. The key should be ;TI"N+:where+ and the value should be the where value to unscope. For example:;T@o;; [I"BUser.where(name: "John", active: true).unscope(where: :name)
;TI"% == User.where(active: true)
;T;
0o;
; [I"3This method is similar to #except, but unlike ;TI"(#except, it persists across merges:;T@o;; [
I"4User.order('email').merge(User.except(:order))
;TI" == User.order('email')
;TI"
;TI"5User.order('email').merge(User.unscope(:order))
;TI" == User.all
;T;
0o;
; [I":This means it can be used in association definitions:;T@o;; [I"8has_many :comments, -> { unscope(where: :trashed) };T;
0:
@fileI"0lib/active_record/relation/query_methods.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(*args);T@7FI"QueryMethods;TcRDoc::NormalModule00