I have this problems with different kind of database column type: - integer (for *_id and id fields) - string
some with has_many(:id) associations and other with belongs_to.has_many (:string) Hope that'll help you! On Jun 9, 4:28 pm, Pat Allan <[email protected]> wrote: > Okay, well firstly - alias is required if you're using an association. > > What's the type on the database column you're trying to use? > > -- > Pat > > On 09/06/2009, at 10:18 AM, Thibaud Guillaume-Gentil wrote: > > > > > > > me too > > > On Jun 9, 4:09 pm, Greg Weber <[email protected]> wrote: > >> I got the same result with and without the as alias. > > >> On Jun 8, 9:24 pm, Pat Allan <[email protected]> wrote: > > >>> Are you giving the attribute an alias? > > >>> ie: has relationship.attribute, :as => :relationship_attribute > > >>> -- > >>> Pat > > >>> On 09/06/2009, at 12:20 AM, Greg Weber wrote: > > >>>> thanks, I am going back to the older version for now. > > >>>> The part of my configuration that threw the error was > > >>>> has_many :relationship > >>>> define_index { has relationship(:attribute) } > > >>>> On Jun 8, 8:19 pm, Pat Allan <[email protected]> wrote: > >>>>> Hi Greg > > >>>>> I do try to test on older versions of Rails regularly, but 1.2.6 > >>>>> is > >>>>> as > >>>>> far back as I go. So if possible, I'd recommend updating to that. > > >>>>> Besides that, can you outline what your actual define_index > >>>>> block is, > >>>>> and the associations that you're trying to use? > > >>>>> Also, from memory, I think the assoc method expects a symbol, > >>>>> not a > >>>>> string. > > >>>>> Cheers > > >>>>> -- > >>>>> Pat > > >>>>> On 08/06/2009, at 8:02 PM, Greg Weber wrote: > > >>>>>> I have an app with an old version of rails - 1.2.2 > > >>>>>> Thinking Sphinx was mostly working, but then I upgraded to the > >>>>>> newest > >>>>>> version of sphinx, and it broke both has_many and belongs_to > >>>>>> association indexing. It also fails on Rails.configuration, but > >>>>>> that > >>>>>> was easy enough to work around. > > >>>>>> For any has_many association I get the error > >>>>>> "Cannot automatically map attribute #{attribte} in #{Parent > >>>>>> Model} ..." > > >>>>>> It is looking in the parent model, not the association model, > >>>>>> which > >>>>>> seems to be the problem. > > >>>>>> If I do > > >>>>>> define_index do > >>>>>> assoc("association_name").attribute > >>>>>> end > > >>>>>> Then I don't get a failure message, but the generated sql is > >>>>>> still > >>>>>> parent_table.attribute with no joining to the association. > > >>>>>> Any help is appreciated. Maybe someone knows the source can > >>>>>> point me > >>>>>> to where a patch would need to be applied. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
