For my view code you can look here...

http://railsforum.com/viewtopic.php?id=29736


I would love advice from anyone, I am just taking stabs in the dark
right now.

Chris

On Apr 22, 10:19 am, internetchris <[email protected]>
wrote:
> Ok, so I got it working. My is_indexed was defined in the wrong model.
> Here's what I put in the "name" model rather than the "account" model.
>
>  # Thinking Sphinx Search criteria
>   is_indexed :fields => ['name','address','city','state','zip'],
>     :include => [{:association_name => 'account', :field =>
> 's_property_no', :as => 's_property_no'},
>                  {:association_name => 'account', :field =>
> 's_service_address', :as => 's_service_address'}
>
> Does anyone know how I reference the 'name', 'address, etc from a view
> within the account controller views? I can access the "s_property_no,
> s_service_address" just fine. I'm not sure how I refer to the other
> fields I am search on so I can display them in the search results.
>
> Thanks!
>
> Chris
>
> On Apr 22, 9:24 am, internetchris <[email protected]>
> wrote:
>
>
>
> > Hey Everyone,
>
> > So I posted a thread last night with my problem, but since then I have
> > figured out the syntax a little better. I am trying to create indexes
> > on 2 separate models. I have an Account model that "has_many :names"
>
> > class Account < ActiveRecord::Base
>
> > has_many :names, :dependent => :destroy
>
> > is_indexed :fields => ['s_property_no'],
> >     :include => [{:association_name => "name", :field => 'name', :as
> > => 'property_name'}]
>
> >  How do I setup the association between the account and name? When I
> > do rake ultrasphinx:configure, I get an error that says " You have a
> > nil object when you  didn't expect it! The error occured while
> > evaluation nil.constantize. For some reason it's not seeing my "name"
> > model.
>
> > Here's the name model...
>
> > class Name < ActiveRecord::Base
> >   belongs_to :account
>
> > Any help is appreciated.
>
> > Thanks!
>
> > Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to