Forum: Ruby on Rails UltraSphinx Concatenate Syntax??

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
internetchris (Guest)
on 2009-04-22 07:58
(Received via mailing list)
Hey everyone,

I hope someone on this group can help me with an UltraSphinx question.
I am using rails 2.3.2 and I am trying to figure out how
to search my "has_many" model. Here's the example..
I can search my "Account" model just fine. My Account model
"has_many :names"
I would like to search my Account model, and my Name model at the
time. I have seen a few examples,  but I can't seem to get it to
I am pretty familiar with SQL, but I haven't done a JOIN in a while,
and I usually get them backwards if I don't have an example to

Quick run down...

has_many :names, :dependent => :destroy

is_indexed :fields => ['s_property_no', 's_service_address'],
    :concatenate => [{ :class_name => 'Name', :field =>
'name', :association_sql => "LEFT JOIN accounts ON
( = name.account_id)", :as => 'accounts' }]

belongs_to :account

I am sure I have the "is_indexed" statement messed up. This is where
need the help. My "search" function is defined in the "accounts
controller". The only other question I have is what do I put in my
view so the name can be displayed in addition to the account
information? I know how to display the account info, just not the


This topic is locked and can not be replied to.