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 -- 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 > has :format_id, :created_at > where "my_table.deleted = 0 AND (format_id IS NULL OR format_name LIKE 'Indexable Format Name%')" > set_property :delta => :delayed > 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 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.
| ||||||||||||||