Initialize static data from database in application

Hi Group ,
I have a table messages which has some application data which has to
be used not so frequently. Also the data to - be returned depends on
the context. The current strategy that i use is something like
return Message.find_by_id().message_string
This is not very elegant since i am making a database call for some
information which is constant throughout the application.
What i would like to have is that static variables instantiated in
the Message Model ( and they have to be loaded from the database
since new messages are added directly to the database ) once the
application starts and then the return methods can happen at the model
level instead of a database call.
I was asking for this procedure since the current process has the
messages being added directly to the database with the migrations.
Else , i can go back to manually adding them to the model , but was
curious to know if there are any other methods.
Suggestions anyone?


Thanks

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs