Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

activerecord: Add types for load_async #767

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading