File: //usr/local/rvm/gems/ruby-3.0.2/doc/activerecord-6.1.4.1/ri/ActiveRecord/QueryMethods/none-i.ri
U:RDoc::AnyMethod[iI" none:ETI"$ActiveRecord::QueryMethods#none;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"4Returns a chainable relation with zero records.;To:RDoc::Markup::BlankLine o;
; [I"HThe returned relation implements the Null Object pattern. It is an ;TI"Lobject with defined null behavior and always returns an empty array of ;TI"+records without querying the database.;T@o;
; [I"MAny subsequent condition chained to the returned relation will continue ;TI"Ngenerating an empty relation and will not fire any query to the database.;T@o;
; [I"MUsed in cases where a method or scope could return zero records but the ;TI""result needs to be chainable.;T@o;
; [I"For example:;T@o:RDoc::Markup::Verbatim; [I"D@posts = current_user.visible_posts.where(name: params[:name])
;TI"K# the visible_posts method is expected to return a chainable Relation
;TI"
;TI"def visible_posts
;TI" case role
;TI" when 'Country Manager'
;TI"& Post.where(country: country)
;TI" when 'Reviewer'
;TI" Post.published
;TI" when 'Bad User'
;TI"< Post.none # It can't be chained if [] is returned.
;TI" end
;TI"end;T:@format0:
@fileI"0lib/active_record/relation/query_methods.rb;T:0@omit_headings_from_table_of_contents_below000[ I"();T@.FI"QueryMethods;TcRDoc::NormalModule00