I have a STI system something like this:
Model: Fruit
Various Types (via a type column): Apple, Orange, Banana, Grape
So currently I would have routes like this:
url_for(Apple.first) = /apples/1
url_for(Orange.first) = /oranges/2
url_for(Banana.first) = /bananas/3
etc...
After implementing this I have a situation where I would want a select set of Fruit types to default back to just plain Fruit i.e. no STI BUT still keep the type. For example lets say I wanted Apples and Oranges to just be plain old fruit:
url_for(Apple.first) = /fruit/1
url_for(Orange.first) = /fruit/2
url_for(Banana.first) = /bananas/3
I know that I can do this:
fruit_path(Apple.first) = /fruit/1
fruit_path(Orange.first) = /fruit/2
The issue I have with the workaround above is that I have a pile of logic, helpers, etc. that now breaks if I do this.
I know I can clear the type column but that means I lose that type data. I guess I could set a second column (fruit_type etc.) to save this. Seems less ideal but may be my best option.
For reference this question / answer is close to what I am looking for:
The question I am asking: is there a way (in the STI models perhaps) to 'disable' STI on a per-type basis while retaining the type field?
uses_parent_nameis just a simple "macro-method" that defines amodel_nameclass method..model_nameis how ActiveModel translates model instances into routes, i18n keys and parameter keys.