Model extension

Kyku
Wed, 14 Mar 2007 12:58:23 -0000

Hello all, I''m working on optimising database accesses in my Rails
application.

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.

--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---