ruby on rails - Where to store total of all records? -
I have been created with all the projects app on the home page of my Rail Project Management app.
This is very easy to achieve. Right now, I'm just doing this:
& lt; P & gt; Total Project: & lt;% = Project.count% & gt; & Lt; / P & gt; However, I do not like the fact that every time a user sees the home page
Is there a more effective way to store the store in a project total, eg a variable or a file?
By the way, there is no need to be super-numeric for counting. I want to use it for marketing purposes.
Thanks for any help.
Application Controller in You:
def project_count Rails.cache Fetch ('project_count') {Project.count} End helpper_method: project_count View in your:
<% = project_count%> & gt; for termination etc.
Comments
Post a Comment