Skip to content

Commit

Permalink
activerecord: Add types for load_async (#767)
Browse files Browse the repository at this point in the history
  • Loading branch information
dak2 authored Jan 16, 2025
1 parent 13de0d8 commit 8ea5c19
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions gems/activerecord/7.0/_test/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Article < ActiveRecord::Base
end

User.where.missing.to_sql
User.where(role: :admin).load_async
User.deterministic_encrypted_attributes
User.source_attribute_from_preserved_attribute(:phrase)
User.insert({ id: 1, name: 'James' }, returning: %i[id name], unique_by: :id, record_timestamps: true)
Expand Down
4 changes: 4 additions & 0 deletions gems/activerecord/7.0/activerecord-7.0.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ module ActiveRecord
end
end

class Relation
def load_async: () -> Relation
end

module Core
def values_at: (*Symbol | String) -> Array[untyped]
def strict_loading!: (?bool value, ?mode: Symbol) -> bool
Expand Down
1 change: 1 addition & 0 deletions gems/activerecord/7.1/_test/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Article < ActiveRecord::Base
end

User.where.missing.to_sql
User.where(role: :admin).load_async
User.deterministic_encrypted_attributes
User.source_attribute_from_preserved_attribute(:phrase)
User.insert({ id: 1, name: 'James' }, returning: %i[id name], unique_by: :id, record_timestamps: true)
Expand Down
2 changes: 2 additions & 0 deletions gems/activerecord/7.1/activerecord-7.1.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ end

module ActiveRecord
class Relation
def load_async: () -> Relation

module Methods[Model, PrimaryKey]
def authenticate_by: (untyped attributes) -> Model?
end
Expand Down
1 change: 1 addition & 0 deletions gems/activerecord/7.2/_test/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Article < ApplicationRecord
end

User.where.missing.to_sql
User.where(role: :admin).load_async
User.deterministic_encrypted_attributes
User.source_attribute_from_preserved_attribute(:phrase)
User.insert({ id: 1, name: 'James' }, returning: %i[id name], unique_by: :id, record_timestamps: true)
Expand Down
1 change: 1 addition & 0 deletions gems/activerecord/7.2/activerecord-7.2.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module ActiveRecord
def insert_all!: (untyped attributes, ?returning: untyped?, ?record_timestamps: bool?) -> untyped
def upsert: (untyped attributes, ?unique_by: untyped?, ?returning: untyped?, ?record_timestamps: bool?) -> untyped
def upsert_all: (untyped attributes, ?unique_by: untyped?, ?returning: untyped?, ?record_timestamps: bool?) -> untyped
def load_async: () -> Relation
end

module Inheritance
Expand Down

0 comments on commit 8ea5c19

Please sign in to comment.