Model extension

Hello all, I’m working on optimising database accesses in my Rails

I’m having a master model and a logging model. For each master there may
be many logging objects, so the master has_many logging objects and the
logging object belongs_to master object.

I’d like to quickly fetch the most recently received logging object for
a master, preferably within a join, so that I can sort and filter in SQL
rather than in Rails. But I can’t simply use :include => logging model
because there are many of the for a single master.

Is there some possible and elegant solution/workaround of this problem
in Rails?
I’m currently replicating the most recently received loging object for
each machine in a separate table, but since the database is updated by
other programs I’m afraid of consitency errors.

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