Hello,

I have a performance related question.

We have a call which runs multiple times per page load. After reading
http://datamapper.org/docs/associations.html we currently have
TranslationTarget.first(:translation_key => {:source => source}) but it
first does a query to table TranslationKey then the query
to TranslationTarget:


DEBUG -  (0.000468) SELECT `id` FROM `translation_keys` WHERE
(`source` = 'Top Referrers' AND `domain` = 'admin')
  DEBUG -  (0.002409) SELECT `id`, `revision_status`,
`revision_account_email`, `locale`, `updated_at`,
`translation_key_id`, `account_id` FROM `translation_targets` WHERE
(`translation_key_id` = 369 AND `locale` = 'pt' AND `revision_status`
= 'approved') ORDER BY `id` LIMIT 1

*(domain and revision_status are not very important fields, just filters)*

Is there a way to use Datamapper here and avoid direct SQL?

Many thanks in advance.

Tiago Duarte Matos
http://tiagomatos.org

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to datamapper+unsubscr...@googlegroups.com.
To post to this group, send email to datamapper@googlegroups.com.
Visit this group at http://groups.google.com/group/datamapper?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to