Hi William,

I wonder if you found an answer to your question – I am having a
similar issue.

Thanks,
Costa.

On Jul 23, 7:12 pm, William <[email protected]> wrote:
> I have a database setup like this:
>
> class Word
>   include DataMapper::Resource
>
>   property :id, Integer, :serial => true
>   property :name, String, :nullable => false, :unique => true
>
>   has n, :wordEntries
> end
>
> class WordEntry
>   include DataMapper::Resource
>
>   property :id, Integer, :serial => true
>   property :timestamp, DateTime
>
>   belongs_to :word
> end
>
> In my situation, I'm going to be counting the number of WordEntries
> for a given Word often, and I'll be relying on soring Words by
> Word.wordEntries.count. As I understand it, DataMapper can't do this
> without resorting to DataMapper.repository.adapter.query (please do
> correct me if I'm wrong).
>
> Does anyone have a suggestion for a better design than this? The only
> other thing I can think of is putting in hooks and adding a
> "numEntries" field to the Words table that is manually updated.
>
> Thanks,
> William
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to