I’m developing a simple CMS, where admin should be able to configure main menu (item positions, adding new items, deleting others, etc) from admin panel. So I’ve figured out that the best way, is not just creating new table in database but dynamically create view, and that’s my problem. In my opinion using database for that is not necessary as the menu will be displayed frequently (it’s on every page) and admin won’t change it too often.
I want Rails to create view (code) in for ex. views/layouts/_main_menu.html.haml including whatever admin will want to put there. Is there any gem for that or should I do it with some kind of ruby script? Does anybody were doing something like that and can support me with code?
Well, in production you’d have to restart the server to reload the new views … so I don’t think it’s the best way to take …
I’d personally store everything in the DB and cache everything properly (fragment caching with proper expiration, take a look here : http://37signals.com/svn/posts/3113-how-key-based-cache-expiration-works)
This way, if menus/pages are not edited, they’ll never be reloaded from SQL