Note that there are some explanatory texts on larger screens.

plurals
  1. POThinking Sphinx and multiple has_one
    text
    copied!<p>I've got multiple has_one associations in my model</p> <pre><code>class Invoice &lt; ActiveRecord::Base ... belongs_to :seller, :class_name =&gt; "Client", :foreign_key =&gt; "provider", :conditions =&gt; ['is_provider = ?', true] belongs_to :customer, :class_name =&gt; "Client", :foreign_key =&gt; "receiver", :conditions =&gt; ['is_receiver = ?', true] </code></pre> <p>I'm trying to index it:</p> <pre><code>indexes [seller(:tbClientCode), seller(:tbClientLabel), seller(:tbClientName), seller(:tbClientNIP), seller(:tbClientRegon), seller(:tbClientZip), seller(:tbClientCity), seller(:tbClientStreet), seller(:tbClientHouseNr), seller(:tbClientHomeNr], :sortable =&gt; true, :as =&gt; :seller_fields has [seller(:is_provider), seller(:is_receiver)], :sortable =&gt; true, :as =&gt; :seller_attributes indexes [customer(:tbClientCode), customer(:tbClientLabel), customer(:tbClientName), customer(:tbClientNIP), customer(:tbClientRegon), customer(:tbClientZip), customer(:tbClientCity), customer(:tbClientStreet), customer(:tbClientHouseNr), customer(:tbClientHomeNr], :sortable =&gt; true), :as =&gt; :customer_fields has [customer(:is_provider), customer(:is_receiver)], :sortable =&gt; true, :as =&gt; :customer_attributes </code></pre> <p>... and then some error occurs</p> <pre><code>ERROR: index 'invoice_core': sql_range_query: ERROR: column reference "is_receiver" is ambiguous LINE 1: ...tomers_invoices"."id" = "invoices"."receiver" AND is_receive... </code></pre> <p>Changing syntax from <em>customer(:tbClientName)</em> to <em>customer.tbClientName</em> is not solution.</p> <p>Some help would be greatly appreciated</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload