Hi Greg

Sorry for not getting back to you sooner on this - it's definitely a bug. There 
have been some changes with the associations search code, but this was just to 
make it a little less fussy about determining the association's attribute. It 
shouldn't have broken other situations, but obviously I made a mistake, and it 
has.

I'll try to reproduce the issue locally and then fix it.

Cheers

-- 
Pat

On 20/02/2010, at 8:56 AM, Greg DeVore wrote:

> I saw some other messages on this but I think this problem is slightly
> different. Some background - have been using the TS plugin (version
> 1.2.9) and am now upgrading to 1.3.16. I am running rails 2.3.5 on Mac
> OS 10.5.
> 
> Models
> ======
> 
> class Lesson < ActiveRecord::Base
>  has_many :bucket_lessons
>  has_many :buckets, :through => :bucket_lessons
> end
> 
> class BucketLesson < ActiveRecord::Base
>  belongs_to :bucket
>  belongs_to :lesson
> end
> 
> class Bucket < ActiveRecord::Base
>  has_many :bucket_lessons
>  has_many :lessons, :through => :bucket_lessons
> end
> 
> Lesson Index
> ==========
> 
> has buckets(:id), :as => :bucket_ids
> 
> The search call is:
> 
> @bucket.lessons.search "string"
> 
> This worked fine with version 1.2.9, but in 1.3.16 it throws the error
> "Missing Attribute for Foreign Key bucket_id"
> 
> I added some logging into has_many_association.rb file in the
> 'attribute_for_foreign_key' method:
> 
> Here is what is being logged:
> "COLUMNS are #{attrib.columns.inspect} AND
> #{attrib.columns.first.__name}"
> 
> The results are:
> [#<ThinkingSphinx::Index::FauxColumn:0x7452228 @name=:id,
> @stack=[:buckets]>] AND id
> 
> In version 1.2.9 TS would combine the stag and name to check the
> foreign key. But in 1.3.16 it is just checking the name which is
> incorrect. Therefore it never finds the bucket_id foreign key.
> 
> By changing the index I can get it to work.
> 
> has bucket_lessons(:bucket_ids), :as => :bucket_ids
> 
> But that it not ideal.
> 
> Was this a deliberate change in the upgrade to 1.3 or is this a bug?
> 
> Greg DeVore
> Blue Mango Learning Systems
> 
> -- 
> 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.

Reply via email to