HEX
Server: Apache
System: Windows NT MAGNETO-ARM 10.0 build 22000 (Windows 10) AMD64
User: Michel (0)
PHP: 7.4.7
Disabled: NONE
Upload Files
File: C:/Ruby27-x64/lib/ruby/gems/2.7.0/doc/activerecord-7.0.4.2/ri/ActiveRecord/QueryMethods/order-i.ri
U:RDoc::AnyMethod[iI"
order:ETI"%ActiveRecord::QueryMethods#order;TF:publico:RDoc::Markup::Document:@parts[#o:RDoc::Markup::Paragraph;	[I"8Applies an <code>ORDER BY</code> clause to a query.;To:RDoc::Markup::BlankLineo;
;	[I"8#order accepts arguments in one of several formats.;T@S:RDoc::Markup::Heading:
leveli:	textI"symbols;T@o;
;	[I"SThe symbol represents the name of the column you want to order the results by.;T@o:RDoc::Markup::Verbatim;	[I"User.order(:name)
;TI"A# SELECT "users".* FROM "users" ORDER BY "users"."name" ASC
;T:@format0o;
;	[I"OBy default, the order is ascending. If you want descending order, you can ;TI"+map the column name symbol to +:desc+.;T@o;;	[I"User.order(email: :desc)
;TI"C# SELECT "users".* FROM "users" ORDER BY "users"."email" DESC
;T;0o;
;	[I"^Multiple columns can be passed this way, and they will be applied in the order specified.;T@o;;	[I"%User.order(:name, email: :desc)
;TI"W# SELECT "users".* FROM "users" ORDER BY "users"."name" ASC, "users"."email" DESC
;T;0S;;
i;I"strings;T@o;
;	[I"JStrings are passed directly to the database, allowing you to specify ;TI"simple SQL expressions.;T@o;
;	[I"PThis could be a source of SQL injection, so only strings composed of plain ;TI"Lcolumn names and simple <code>function(column_name)</code> expressions ;TI"6with optional +ASC+/+DESC+ modifiers are allowed.;T@o;;	[
I"User.order('name')
;TI"3# SELECT "users".* FROM "users" ORDER BY name
;TI"
;TI"User.order('name DESC')
;TI"8# SELECT "users".* FROM "users" ORDER BY name DESC
;TI"
;TI"$User.order('name DESC, email')
;TI"?# SELECT "users".* FROM "users" ORDER BY name DESC, email
;T;0S;;
i;I"	Arel;T@o;
;	[I"KIf you need to pass in complicated expressions that you have verified ;TI"1are safe for the database, you can use Arel.;T@o;;	[I"3User.order(Arel.sql('end_date - start_date'))
;TI"D# SELECT "users".* FROM "users" ORDER BY end_date - start_date
;T;0o;
;	[I"SCustom query syntax, like JSON columns for Postgres, is supported in this way.;T@o;;	[I".User.order(Arel.sql("payload->>'kind'"))
;TI"># SELECT "users".* FROM "users" ORDER BY payload->>'kind';T;0:
@fileI"0lib/active_record/relation/query_methods.rb;T:0@omit_headings_from_table_of_contents_below000[I"(*args);T@PFI"QueryMethods;TcRDoc::NormalModule00