Can't tell what's wrong here. I'm trying to filter on the state
property of my address
association.
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
But when I run rake ts:index
, I get the error below.
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...
Any ideas?
I'm not sure how to fix the FROM-clause problem, but if I use the table name instead of the property name, I can fix this with a group_by
clause.
has 'CRC32(addresses.state)', :as => :state, :type => :integer
group_by "addresses.state"