Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion How to define a WHERE condition on an association
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Pat Allan  
View profile  
 More options Nov 14 2012, 6:10 am
From: "Pat Allan" <p...@freelancing-gods.com>
Date: Wed, 14 Nov 2012 06:09:40 -0500
Local: Wed, Nov 14 2012 6:09 am
Subject: Re: [ts] How to define a WHERE condition on an association
Yeah, rake or ruby probably add a format method to the global scope. Wouldn't surprise me.

Try using the column reference as opposed to the alias in your WHERE clause: formats.name instead of format_name.

Cheers

--
Pat

On 14/11/2012, at 10:11 AM, gmoniey wrote:

> Hi,

> I have a simple define index, and I want to limit the indexed records to those that have an association on a nullable field. Here is what my define_index block looks like:

>   define_index do
>     indexes :name, :sortable => true

>     has :format_id, :created_at
>     has assoc(:format).name, :as => :format_name

>     where "my_table.deleted = 0 AND (format_id IS NULL OR format_name LIKE 'Indexable Format Name%')"

>     set_property :delta => :delayed
>   end

> The error that I get when indexing is: Unknown column 'format_name'. I was wondering if the above is even possible?

> Also, just wanted to double check that my assoc has line is correct? Seems like 'format' is a reserved keyword.

> Thanks.

> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/YCHISgI1onAJ.
> To post to this group, send email to thinking-sphinx@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphinx+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.