This suggestion seems to be a little bit more "ruby way" and tends to
organize the code a bit more...

On 9/29/07, Andrew Kaspick <[EMAIL PROTECTED]> wrote:
>
>
> I was thinking about this recently, but was toying around with a
> different, possibly more flexible syntax...
>
> :conditions => {:comments => {:created_at ' => 14.days.ago..7.days.ago}}
>
> Combined with normal conditions...
>
> :conditions => {:field => value, :comments => {:created_at ' =>
> 14.days.ago..7.days.ago}}
>
> You could nest as deep as you like in the same way :include works.
>
> Any issues with this approach instead?
>
> Andrew
>
> On 9/28/07, Jack Danger Canty <[EMAIL PROTECTED]> wrote:
> > Ahoy!
> >
> > Have you guys ever needed to do this?:
> >
> > Post.find(:all, ;include => :comments, :conditions => {'
> comments.created_at
> > ' => 14.days.ago..7.days.ago})
> >
> > Well, I certainly have.  And I finally got around to patching
> > sanitize_sql_hash_for_conditions() so rather than doing
> > this:
> > "SELECT ... WHERE posts.`comments.created_at` BETWEEN ..."
> > it provides us with:
> > "SELECT ... WHERE comments.created_at BETWEEN ..."
> >
> >
> > And you can have the whole package for the low, low price of a +1.
> >
> > http://dev.rubyonrails.org/ticket/9733
> >
> > ::Jack Danger
> >  >
> >
>
> >
>


-- 
Carlos Palhares JĂșnior
[EMAIL PROTECTED]
+55 (31) 8763-5606
Milk-it Brasil Software House
--
"If you have any great suggestions, feel free to mail me, and I'll probably
feel free to ignore you." Linus Torvalds

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to