In a Rails 3.2 app there is a template that has two pull down menus that are populated by a database. With jQuery i refresh the template when a different selection is made from one of the pull down menus. Other than that, i would prefer not to reload the template so the database is not repeatedly hit unnecessarily. To be clear, the template should not be reloaded when another page is loaded. I thought that the following would do it, but it doesn't.
config.action_view.cache_template_loading = true
Thanks for your help.
Try this concept.
@all ||= User.all
If @all already has a value it will not query again from the DB.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.