Skip to content

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

gems/activerecord/7.2/_test/activerecord-7.2.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,9 @@ class Article < ApplicationRecord
8484
User.with_recursive(admin_users: User.where(role: 0))
8585

8686
ActiveRecord::Base.lease_connection.execute('SELECT * FROM users LIMIT 100;')
87+
88+
User.unscope(:order)
89+
User.order(:id).unscope(:order)
90+
User.reorder(id: :asc)
91+
User.order(id: :asc).reorder(id: :desc)
8792
end

gems/activerecord/7.2/activerecord-7.2.rbs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ module ActiveRecord
228228
def with: (*untyped args) -> self
229229
def with_recursive: (*untyped) -> self
230230
def with_recursive!: (*untyped) -> self
231+
def reorder: (*untyped args) -> self
232+
def unscope: (*untyped args) -> self
231233
def sole: () -> Model
232234
end
233235
end
@@ -236,6 +238,8 @@ module ActiveRecord
236238
module ClassMethods[Model, Relation, PrimaryKey]
237239
def with: (*untyped args) -> Relation
238240
def with_recursive: (*untyped) -> Relation
241+
def reorder: (*untyped args) -> Relation
242+
def unscope: (*untyped args) -> Relation
239243
end
240244
end
241245
end
@@ -252,6 +256,8 @@ interface _ActiveRecord_Relation[Model, PrimaryKey] # rubocop:disable RBS/Lint/T
252256
def order: (*untyped) -> self
253257
def group: (*Symbol | String) -> untyped
254258
def in_order_of: (Symbol, Array[untyped]) -> self
259+
def reorder: (*untyped args) -> self
260+
def unscope: (*untyped args) -> self
255261
def distinct: () -> self
256262
def or: (::ActiveRecord::Relation) -> self
257263
def merge: (Array[untyped] | Hash[untyped, untyped] | ActiveRecord::Relation | Proc) -> self
@@ -350,6 +356,8 @@ interface _ActiveRecord_Relation_ClassMethods[Model, Relation, PrimaryKey] # rub
350356
def order: (*untyped) -> Relation
351357
def group: (*Symbol | String) -> untyped
352358
def in_order_of: (Symbol, Array[untyped]) -> Relation
359+
def reorder: (*untyped args) -> Relation
360+
def unscope: (*untyped args) -> Relation
353361
def distinct: () -> Relation
354362
def or: (::ActiveRecord::Relation) -> Relation
355363
def merge: (Array[untyped] | Hash[untyped, untyped] | ActiveRecord::Relation | Proc) -> Relation

gems/activerecord/8.0/_test/activerecord-8.0.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,9 @@ class Article < ApplicationRecord
8484
User.with_recursive(admin_users: User.where(role: 0))
8585

8686
ActiveRecord::Base.lease_connection.execute('SELECT * FROM users LIMIT 100;')
87+
88+
User.unscope(:order)
89+
User.order(:id).unscope(:order)
90+
User.reorder(id: :asc)
91+
User.order(id: :asc).reorder(id: :desc)
8792
end

gems/activerecord/8.0/activerecord-8.0.rbs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ module ActiveRecord
228228
def with: (*untyped args) -> self
229229
def with_recursive: (*untyped) -> self
230230
def with_recursive!: (*untyped) -> self
231+
def reorder: (*untyped args) -> self
232+
def unscope: (*untyped args) -> self
231233
def sole: () -> Model
232234
end
233235
end
@@ -236,6 +238,8 @@ module ActiveRecord
236238
module ClassMethods[Model, Relation, PrimaryKey]
237239
def with: (*untyped args) -> Relation
238240
def with_recursive: (*untyped) -> Relation
241+
def reorder: (*untyped args) -> Relation
242+
def unscope: (*untyped args) -> Relation
239243
end
240244
end
241245
end
@@ -252,6 +256,8 @@ interface _ActiveRecord_Relation[Model, PrimaryKey] # rubocop:disable RBS/Lint/T
252256
def order: (*untyped) -> self
253257
def group: (*Symbol | String) -> untyped
254258
def in_order_of: (Symbol, Array[untyped]) -> self
259+
def reorder: (*untyped args) -> self
260+
def unscope: (*untyped args) -> self
255261
def distinct: () -> self
256262
def or: (::ActiveRecord::Relation) -> self
257263
def merge: (Array[untyped] | Hash[untyped, untyped] | ActiveRecord::Relation | Proc) -> self
@@ -350,6 +356,8 @@ interface _ActiveRecord_Relation_ClassMethods[Model, Relation, PrimaryKey] # rub
350356
def order: (*untyped) -> Relation
351357
def group: (*Symbol | String) -> untyped
352358
def in_order_of: (Symbol, Array[untyped]) -> Relation
359+
def reorder: (*untyped args) -> Relation
360+
def unscope: (*untyped args) -> Relation
353361
def distinct: () -> Relation
354362
def or: (::ActiveRecord::Relation) -> Relation
355363
def merge: (Array[untyped] | Hash[untyped, untyped] | ActiveRecord::Relation | Proc) -> Relation

0 commit comments

Comments
 (0)