On Jan 4, 10:27 am, deadwards <[email protected]> wrote:
> Say I have a User that has many Entries.  Could I search for all users
> that have entries before a certain date OR after a certain date?
>
> In Rails/AR:
> User.all(:includes => :entries, :conditions => ["entries.created_at
> <= ? OR entries.created_at >= ?", 6.weeks.ago, 2.weeks.ago])

Something like this might work:

  User.all(User.entries.created_at.lte => 6.weeks.ago,
User.entries.created_at.gte => 2.weeks.ago)

If this doesn't work, please reply with the User and Entry models so I
can try to duplicate your scenario locally.

Dan
(dkubb)
--~--~---------~--~----~------------~-------~--~----~
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