Hey everyone,
I was trying to find a group for ultrasphinx so I hope I found the
right group. 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 same
time. I have seen a few examples, but I can't seem to get it to work.
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
follow.
Quick run down...
account.rb
------------------------------------------------------------
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
(accounts.id = name.account_id)", :as => 'accounts' }]
end
name.rb
-----------------------------------------------------------
belongs_to :account
I am sure I have the "is_indexed" statement messed up. This is where I
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 name
info.
Thanks!
Chris
--~--~---------~--~----~------------~-------~--~----~
Insoshi developer site: http://dogfood.insoshi.com/
Insoshi documentation: http://docs.insoshi.com/
You received this message because you are subscribed to the Google
Groups "Insoshi" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/insoshi?hl=en
-~----------~----~----~----~------~----~------~--~---