1

ここで何が問題なのかわかりません。state関連付けのプロパティをフィルター処理しようとしていますaddress

class Organization < ActiveRecord::Base
  has_one :address, :as => :addressable, :dependent => :destroy

  define_index do
    indexes :name, :sortable => true

    has mec_revenue
    has 'CRC32(status)', :as => :status, :type => :integer
    has 'CRC32(address.state)', :as => :state, :type => :integer
    set_property :delta => true
  end

end

しかし、実行するrake ts:indexと、以下のエラーが発生します。

indexing index 'organization_delta'...
ERROR: index 'organization_delta': sql_range_query: ERROR:  missing FROM-clause entry for table "address"
LINE 1: ...S "mec_revenue", CRC32(status) AS "status", CRC32(address.st...

何か案は?

4

1 に答える 1

0

FROM 句の問題を修正する方法がわかりませんが、プロパティ名の代わりにテーブル名を使用すると、group_by句でこれを修正できます。

has 'CRC32(addresses.state)', :as => :state, :type => :integer
group_by "addresses.state"
于 2012-10-09T18:24:27.557 に答える