#2 ✓resolved
cesidio

Add joins to conditions

Reported by cesidio | September 22nd, 2008 @ 01:29 PM

If we need to add joins tables to our search query, it would be nice to benefit of Searchgasm cleaner way of specifing conditions. like in the following:

@posts = Post.all(:joins => :blog, :conditions => ['blog.url = ?', "http://.."])

it would became:

@posts = Post.all(:joins => :blog, :conditions => {:blog => {:url_contains => "url"}})

this is not a good example because it is evident that there would be a belongs_to relationship between Post and Blog, but let's just put the case there isn't

Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson September 22nd, 2008 @ 01:39 PM

    • State changed from “new” to “open”

    I'm a little confused, do you mind clarifying a little bit more? Searchgasm automatically includes based on what it knows. So if you order or set conditions on associations it will automatically include them.

  • Ben Johnson

    Ben Johnson September 22nd, 2008 @ 02:38 PM

    Ok, do you mind clarifying a little bit more so I can understand exactly what you are trying to do. Thanks!

  • Ben Johnson

    Ben Johnson September 22nd, 2008 @ 08:54 PM

    • State changed from “open” to “resolved”

    Hi, I released a new version that uses joins instead of include. Update and you should see it take effect. Joins are much faster. Let me know if this fixes your problem. Thanks.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Provides common named scopes and object based searching.

People watching this ticket

Pages