1

示例:我们有一个模型 Book (title:string desc:text) 和一个模型 Reader (some_integer:integer book_id:integer name:string)

class Book < ActiveRecord::Base


has_many :readers

  define_index do    
    indexes id
    indexes title      
    indexes descr
    join    readers   
    has     readers(:wert_integer), :as => :wert_integer, :sortable => true, :type => :integer
    has     readers(:first_name), :as => :first_name, :sortable => true
    has     readers(:last_name), :as => :last_name, :sortable => true
    set_property :delta => :delayed
  end
end

class Reader < ActiveRecord::Base
  belongs_to :book
end

尝试保存图书时,出现此错误:

undefined method `wert_integer' for []:ActiveRecord::Relation

我们做错了什么?

4

0 回答 0