This feels similar to this long-ago bug - #203 - which was fixed here - #592
Model of:
class Classification < ApplicationRecord
belongs_to :classifiable, polymorphic: true
belongs_to :topic
validates :classifiable_id, :uniqueness => { :scope=> [:topic_id, :classifiable_type] }
end
Spec of:
require "rails_helper"
describe Classification do
it { should belong_to(:classifiable) }
it { should belong_to(:topic) }
it "ensures uniqueness" do
create(:classification)
should validate_uniqueness_of(:classifiable_id).scoped_to([:topic_id, :classifiable_type])
end
end
Relevant output is:
Failures:
1) Classification ensures uniqueness
Failure/Error: should validate_uniqueness_of(:classifiable_id).scoped_to([:topic_id, :classifiable_type])
ActiveRecord::SubclassNotFound:
Invalid single-table inheritance type: Show is not a subclass of Shoulda::Matchers::ActiveRecord::Uniqueness::TestModels::Producu
# ./spec/models/classification_spec.rb:9:in `block (2 levels) in <top (required)>'
That ::Producu on the very end there in the error makes me suspect that we're calling next on a string with Product (or something?) somewhere in the codebase.
This feels similar to this long-ago bug - #203 - which was fixed here - #592
Model of:
Spec of:
Relevant output is:
That
::Producuon the very end there in the error makes me suspect that we're callingnexton a string withProduct(or something?) somewhere in the codebase.