Skip to content

Commit

Permalink
activerecord: add ActiveRecord::Core#values_at
Browse files Browse the repository at this point in the history
  • Loading branch information
dak2 committed Dec 15, 2024
1 parent 400a2ec commit 3fd2eea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gems/activerecord/6.1/_test/activerecord-6.1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
user.articles.insert_all!([{ id: 1, name: 'James' }], returning: %i[id name], record_timestamps: true)
user.articles.upsert({ id: 1, name: 'James' }, returning: %i[id name], unique_by: :id, record_timestamps: true)
user.articles.upsert_all([{ id: 1, name: 'James' }], returning: %i[id name], unique_by: :id, record_timestamps: true)
user.values_at(:name, :age)
user.values_at("name", :age)
4 changes: 4 additions & 0 deletions gems/activerecord/6.1/activerecord-6.1.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ module ActiveRecord
extend DelegatedType
end

module Core
def values_at: (*Symbol | String) -> Array[untyped]
end

class AssociationRelation
def insert: (untyped attributes, ?unique_by: untyped?, ?returning: untyped?, ?record_timestamps: bool?) -> untyped
def insert_all: (untyped attributes, ?unique_by: untyped?, ?returning: untyped?, ?record_timestamps: bool?) -> untyped
Expand Down

0 comments on commit 3fd2eea

Please sign in to comment.