This might be a very basic question, but since i’m new to rails, can you
please let me kow how to do this.
My app is like this i have a menu in the left side which says “Status”
and if i click this link i have a static menu displayed like this
“MachineA” MachineB" and “MachineC”
Upon clicking any of those machines i need to display a bunch of
information corresponding to that link. Say how much is RAM, HardDisk,
OS etc of each machines for the corresponding link.
I have these details captured in a properties file like
What i’m currently doing is upon clicking each of the links say
“MachineA” i’m reading the entire properties file and after that finding
which is the link the user has clicked and store into some variable and
pass this value to the Views to display into the browser.
But the problem is that each time the “property file is read” when ever
user clicks the links and then find out which is the link and filter out
that env. which i guess can be done in a better way. hence two question
what i thought is i will read the property file when the user click on
the left side of the link (instead of everytime the individual links is
clicked), and when ever the individual env is clicked, now filter and
pass these value to the view/browser., i’m not sure how to do this. The
problem what i’m facing is lets say when the user clicks the left side
menu, the action “show” is been called were i read the properties file
and puts them in a hash of key/value paris and name the hash as @env.
Now when i click the indivudal link, and if i query the above @env i’m
getting nul, this value is not persisted, i.e i think i’m not stroring
the @env in the “show” method in a proper way using
class/instance/global variable such that from any of the actions in that
page if i access this value i should be able to get the @env. not sure
how to do this. OR is that we should use “Model” to do this?
The second question is is there a way to use “Caching” and do the above
job in a better way, ie since the property file is a “static” data, load
this data only once when the server starts and read this @env were ever
we need ?