i have a simple model called key_words.rb
the purpose of this is to hold system config data.
it also holds the parameters that our system uses to judge the
condition of the stuff we monitor.
my question is… we use this to process a lot of information,
sometimes a few thousand records
will go thru this and i think it could be a performance killer.
i wanted to make this a session variable so that it would not have to
go to the database and redraw it a few thousand times on a page
refresh.
so i thought
def self.get_in_wet_list(status)
wet_list = session[:wet_list]
if wet_list.nil?
wet_list = find(:first,
:conditions => "name = ‘wet_list’ ")
end
wet_list.message.split(’,’).include?(status)
end
the only thing is that a model does not seem to be able to access
session variables.
at any rate, does someone have an idea about how to make this work
better ?
ok, one more thing,
i have a wet_list, but also have a dry_list , fwd_list, etc…
i suppose i could lump them all into one class and each list could be
another method.
so does rails keep up with this model for the whole session ?
forget it, i went ahead and tried it and it worked like a charm,
pages are loading much much faster.
thanks for taking your time on this for me, Chris.
You really made a difference
thanks a whole lot !
yes, the variable is fairly static, changes maybe once a week or month.
is small too, and example would be wet_list = ‘w,W,ww,rw’ and thats it.
thanks so much for this help !
sk
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.