Skip to main content
Ask A Question
You’re not receiving notifications from this thread.

Message Templates Discussion

General • Asked by Chris Oliver
Related episode

super keen to see this the other way - so you pick the inputs before generating the template. Thanks Chris

thanks Chris love this one, got it working in mins.

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.

It works well with text area, but if I use rich text editor, the text wont show on the text editor.

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 31,353+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.