Found this issue today. The way set_sphinx_primary_key works is to set an 
instance variable that holds the primary key attribute.
This works when you want to set the attribute for a single class, but it is 
lost in all child classes.

*Problem:*
class Foo < ActiveRecord::Base
  set_sphinx_primary_key :bar
end

class Foobar < Foo
end

Foobar.sphinx_primary_key should be the 'bar' attribute, but it defaults to 
'id'


*Solution:*
The way to fix this is to set a method that returns the primary key 
attribute. We've got the test and new code in this commit, which we've 
submitted a pull request for.

https://github.com/reenhanced/thinking-sphinx/commit/683cdc8c3c7af404a19a36023548379d80ba9149

I'm sorry about the stupid whitespace changes, we've commented the 
appropriate places for the code and tests, so they should be easy to find.

Thanks!
Nick

-- 
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