Chris, what are you thoughts on keeping the template records inside the same table instead of a separate one? I know this wouldn't work for all situations, but I have a situation where 5 tables each have templates, so I have 10 tables to maintain and they're essentially duplicates of each other (one for the live data and the other for templates).
In order to reduce the DB complexity and cut down on maintenance, I'm thinking about combining the template tables into the normal tables and adding a `template:boolean` field.
That way there's only 1 version of the models to maintain and DB changes don't have to be kept in sync between multiple tables.
Yep, you can do that and use scopes in order to filter those as necessary.
Another alternative is a single Template table that stores templates for any object, where you store all the values in a serialized text, hstore or json column. The downside to this is that sometimes you can run into issues with data types not being consistent in the serialized ones.
Join 31,353+ developers who get early access to new screencasts, articles, guides, updates, and more.