I’m looking for a way to show same @item in different ways.
For example if @item.template == template1 – when I hit the “show” link – I see one layout.
For template2 I see another layout of same item etc. By layout I mean different font, different table design etc.
What is the best way to do this?
Right now I have two ideas: Either have a special table, where column1 is template name, and column2 is HTML, and then I just take HTML and insert @item content. Another idea is to have many .haml files, and make a choice in the controller using render command.
But I’m still not sure. Maybe you can suggest something.
I would go with many layout files as it’s easier to maintain, version and you can use partials and all that stuff. So something like this in the controller action: