parent
812a2c1d6c
commit
580eefe1bc
@ -90,7 +90,7 @@ def signed_id_verifier=(verifier)
|
||||
|
||||
# :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 @@
|
||||
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 New Issue
Block a user