Hi Larry I'm not sure why 'act' is a reserved word - I would expect the following to work:
has act.pol_id, :as => :politician Otherwise, though, the trick is that you're starting with a symbol, and so you need to use the assoc method: has assoc(:act).pol_id, :as => :politician Cheers -- Pat On 26/05/2010, at 4:50 AM, Larry wrote: > Hi Pat, > > Thanks a lot for your reply. Unfortunately, that doesn't work for me. > I hope I'm not being dumb and thick, but here's what I have... > > (BTW, I have only seen the following words described as being > problematic: id, name, type. What's causing the problem for me is, > surprisingly, the word 'act'.) > > Here is what I have in my model file: > belongs_to :act, :class_name => 'Activity::Act', > :foreign_key => 'activity_act_id' > > And below it (so I can use the association) I want to define an > attribute to be used for filtering results. That attribute is the > 'pol_id' field in the Activity::Act table. > > However, when I try this within my 'define_index' block I get a > "syntax eror, unexpected ',' " error: > > has (:act, :pol_id), :as => :politician > > Ideally I should be able to specify the association as follows: > has act.pol_id > but that doesn't work. I have tried other combinations and can't get > anything to work. > > Thanks for any help anyone can give, > Larry > > > > On May 22, 1:22 pm, Pat Allan <[email protected]> wrote: >> Hi Larry >> >> The following should work: >> state(:name, :abbrev) >> >> Hope this helps :) >> >> -- >> Pat >> >> On 23/05/2010, at 1:47 AM, Larry wrote: >> >> >> >>> Hi, >> >>> First things first: Thanks for this truly great gem!!! >> >>> I know that you can drill down on associations and I know that >>> reserved words (e.g. name, id) should be turned into a symbol >>> (e.g. :name, :id). >> >>> And I have seen examples where the reserved association/word comes at >>> the end of a "drill down", e.g. instead of state.name you should use >>> state(:name). >> >>> But what if the reserved word occurs within the middle of a "drill >>> down", e.g. state.name.abbrev ? state(:name).abbrev doesn't work; does >>> anyone know what will? >> >>> Thanks, >>> Larry >> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Thinking Sphinx" 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 >>> athttp://groups.google.com/group/thinking-sphinx?hl=en. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Thinking Sphinx" 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 >> athttp://groups.google.com/group/thinking-sphinx?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" 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/thinking-sphinx?hl=en. > -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" 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/thinking-sphinx?hl=en.
