【发布时间】:2015-07-18 05:32:42
【问题描述】:
我有一个 Artwork 模型,它与 HABTM 的模型 Subject、Location、Keyword、Style 和 Medium 相关联。我还与一对多的Artist 模型建立了关联。这是我不断收到的错误:
>rake ts:index
Generating configuration to /Users/<user>/Developer/jtodd/jtoddgalleries/config/development.sphinx.conf
rake aborted!
NoMethodError: undefined method `klass' for nil:NilClass
这是我的索引文件:
ThinkingSphinx::Index.define :artwork, :with => :active_record do
indexes title, :sortable => true
has jtg
has width
has height
has subject.id, :as => :subject_ids
has location.id, :as => :location_ids
has keyword.id, :as => :keyword_ids
has artist.first_name, :as => :artist_first
has artist.last_name, :as => :artist_last
has style.id, :as => :style_ids
has medium.id, :as => :medium_ids
end
我不明白为什么我不断收到不同的错误。我可能对字段与属性没有牢牢把握,也许这就是我出错的地方。非常感谢任何帮助,谢谢!
【问题讨论】:
标签: ruby-on-rails indexing associations rake thinking-sphinx