On 9/29/07, Andrew Kaspick <[EMAIL PROTECTED]> wrote:
>
>
> I mentioned nesting to any depth before (just off the top of my head),
> but I'm not sure if that's useful or not...
I don't think we'll need the extra depth, just :conditions => {:table =>
{:column => 'value'}} should suffice. I can't think of any complication
beyond that that would be useful.
It should be as simple as checking whether the given value is a hash - no
recursion should be necessary.
::Jack Danger
Doing this...
>
> Post.find(:all, ;include => {:comments => :users}, :conditions =>
> {:comments => {:users => {:name => 'Joe'}, :created_at =>
> 14.days.ago..7.days.ago}})
>
> would be the same thing as...
>
> Post.find(:all, ;include => {:comments => :users}, :conditions =>
> {:comments => {:created_at => 14.days.ago..7.days.ago}, :users =>
> {:name => 'Joe'}})
>
> resulting in...
>
> comments.created_at BETWEEN ... AND users.name = 'Joe'
>
> My patch does work with conditions to any depth, but is it useful? I
> suppose it could make things look cleaner as to better match the style
> of the :include and there might be other styles or uses that I can't
> think of at the moment.
>
> My patch right now is recursive which allows the extra depth, but if
> that's not seen as useful, I'll rewrite it with an iterative approach
> and not allow the extra depth.
>
> Andrew
>
> On 9/30/07, Andrew Kaspick <[EMAIL PROTECTED]> wrote:
> > Almost done. :)
> >
> > On 9/30/07, Jack Danger Canty <[EMAIL PROTECTED]> wrote:
> > >
> > > 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}}
> > >
> > >
> > > That's way better! Care to write a patch?
> > >
> > > ::Jack Danger
> > >
> > > > >
> > >
> >
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---