ruby on rails - Where to store total of all records? -
I have been created with all the This is very easy to achieve. Right now, I'm just doing this: 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: View in your: for termination etc. projects app on the home page of my Rail Project Management app.
& lt; P & gt; Total Project: & lt;% = Project.count% & gt; & Lt; / P & gt;
def project_count Rails.cache Fetch ('project_count') {Project.count} End helpper_method: project_count
<% = project_count%> & gt;
Comments
Post a Comment