Closed morphine00 closed 2 years ago
Addendum:
Ok, issue solved: one of my fields in the view was named type
, and that's a reserved word in Active Record. That caused AR to think that I was actually querying TableA or TableB, hence the subclass error. Closing.
Hi, I designed a view that merges records from two tables. When trying to use a model based on that view, depending on what I'm trying to do, I get either
ActiveRecord::SubclassNotFound (Invalid single-table inheritance type: TableA is not a subclass of MergeModel)
orActiveRecord::SubclassNotFound (Invalid single-table inheritance type: TableB is not a subclass of MergeModel)
Here's what the SQL roughly looks like:
And here's the model. The "custom_id" field is custom-generated on the view.
Am I doing anything wrong? Any ideas?