Hey there, i am in my 4th day of working in rails. I dig it a lot. I
have a question about the best way to go about something.
We monitor the conditions of equipment
each piece of equipment has a current status.
each status will corrospond to a list in a table that we have called
key_words is just kinda like a configuration settings table, no
relationships, just a list of keys and values.
so i have something like this in key_words
key = 'running' value = 'r, run, running, rng, pwr, power_on'
key = 'not_running' value = 's, stp, stop, not_rng'
so each value is actually a list of possibilities. i need to be able to
pass a status to see which list its in.
so if i pass 'r' to the function, it will return 'running' and i can
use that to display an image on the website that shows that the machine
now, i am pretty sure i can pull this off, but i wanted some opinion of
where to put it. Do i put it in the key_words.rb model,
key_words_controller.rb or in the application.rb ( as it will be used
in more than one place)
i thought it would go a little something like this
running = KeyWord.find(1, :conditions => " key = 'running' " ) #
this will get me the list
look thru pickaxe to see how to tell if status in the list returned
return true if (status is in running list)
i suppose it would look different if its in the key_words.rb model
any advice ?