mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
parent
812a2c1d6c
commit
580eefe1bc
2 changed files with 6 additions and 2 deletions
|
@ -90,7 +90,7 @@ module ActiveRecord
|
|||
|
||||
# :nodoc:
|
||||
def combine_signed_id_purposes(purpose)
|
||||
[ name.underscore, purpose.to_s ].compact_blank.join("/")
|
||||
[ base_class.name.underscore, purpose.to_s ].compact_blank.join("/")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ SIGNED_ID_VERIFIER_TEST_SECRET = -> { "This is normally set by the railtie initi
|
|||
ActiveRecord::Base.signed_id_verifier_secret = SIGNED_ID_VERIFIER_TEST_SECRET
|
||||
|
||||
class SignedIdTest < ActiveRecord::TestCase
|
||||
fixtures :accounts, :toys
|
||||
fixtures :accounts, :toys, :companies
|
||||
|
||||
setup do
|
||||
@account = Account.first
|
||||
|
@ -26,6 +26,10 @@ class SignedIdTest < ActiveRecord::TestCase
|
|||
assert_equal @toy, Toy.find_signed(@toy.signed_id)
|
||||
end
|
||||
|
||||
test "find signed record for single table inheritance (STI Models)" do
|
||||
assert_equal Company.first, Company.find_signed(Company.first.signed_id)
|
||||
end
|
||||
|
||||
test "raise UnknownPrimaryKey when model have no primary key" do
|
||||
error = assert_raises(ActiveRecord::UnknownPrimaryKey) do
|
||||
Matey.find_signed("this will not be even verified")
|
||||
|
|
Loading…
Reference in a new issue