I have these two variables being set in the controller. How do I cache these so they don’t communicate with the database each time, only the first time.
@tablenutrients = Nutrient.find(:all)
@columnnutrients = @tablenutrients.collect {|x| x.nutrient}
what @djlumley said.
In general, you can also configure and use ActiveSupport::Cache::Store to explicitly store your own custom variables. You could then get/set cached values, for example, like this: