Skip to content

Commit 41888b1

Browse files
authored
Merge pull request rails#51800 from Shopify/refactor-find_signed
2 parents 77909f3 + c6d0ef5 commit 41888b1

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

activerecord/lib/active_record/relation.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def exec_explain(&block)
6666

6767
include Enumerable
6868
include FinderMethods, Calculations, SpawnMethods, QueryMethods, Batches, Explain, Delegation
69+
include SignedId::RelationMethods
6970

7071
attr_reader :table, :klass, :loaded, :predicate_builder
7172
attr_accessor :skip_preloading_value

activerecord/lib/active_record/signed_id.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ module SignedId
1313
class_attribute :signed_id_verifier_secret, instance_writer: false
1414
end
1515

16+
module RelationMethods # :nodoc:
17+
def find_signed(...)
18+
scoping { model.find_signed(...) }
19+
end
20+
21+
def find_signed!(...)
22+
scoping { model.find_signed!(...) }
23+
end
24+
end
25+
1626
module ClassMethods
1727
# Lets you find a record based on a signed id that's safe to put into the world without risk of tampering.
1828
# This is particularly useful for things like password reset or email verification, where you want

0 commit comments

Comments
 (0)