Need Help with Custom Associations

I’ve read the Rails Envy AAF tutorial at
http://railsenvy.com/2007/2/19/acts-as-ferret-tutorial and its given me
some really good ideas.

My problem lies in having AAF search the target Model’s child tables.

I have no problem at all doing something like:
acts_as_ferret :fields => [:title, :update_collection, :member_name]

def member_name
    return "#{self.member.username}"
end

However when I try to query child tables like such…
def update_collection
self.place_updates.collect { |update| update.description }.join
’ ’
end
I have no luck.

I know the method is working because if I do something like

raise Model.find(5).update_collection.inspect it returns a string with
all descriptions.

Any ideas? I would really appreciate any help!

Dave

On Mon, Oct 01, 2007 at 06:37:05AM +0200, Dave Munson wrote:

    return "#{self.member.username}"

raise Model.find(5).update_collection.inspect it returns a string with
all descriptions.

Any ideas? I would really appreciate any help!

most probably the collection isn’t there yet when aaf indexes your
record. Have a look at your log file to see what value aaf gets from
your method when it calls it.

cheers,
Jens


Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
[email protected] | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa

most probably the collection isn’t there yet when aaf indexes your
record. Have a look at your log file to see what value aaf gets from
your method when it calls it.

Hmmm, I’m pretty new to this whole thing. I tried looking in my
development.log file (140 gigs and counting!) and its showing nothing.

I deleted my indexes and restarted the server and it picked up the
keywords I was searching for… however this is my problem.

Once I edit one of the records and remove a keyword, or add a keyword,
its not reflected in the index I guess?

Is this normal? Is it possible to have it act as a live search?

development.log file (140 gigs and counting!) and its showing nothing.

Meant to say, 140 megs and counting…

On Tue, Oct 02, 2007 at 12:00:53AM +0200, Dave Munson wrote:

most probably the collection isn’t there yet when aaf indexes your
record. Have a look at your log file to see what value aaf gets from
your method when it calls it.

Hmmm, I’m pretty new to this whole thing. I tried looking in my
development.log file (140 gigs and counting!) and its showing nothing.

Aaf logs something like
“Adding field fieldname with value ‘fieldvalue’ to index”
whenever it indexes a record.

I deleted my indexes and restarted the server and it picked up the
keywords I was searching for… however this is my problem.

Once I edit one of the records and remove a keyword, or add a keyword,
its not reflected in the index I guess?

If everything works correctly, it should. How does your test code for
adding a keyword and saving the record look like?

Is this normal? Is it possible to have it act as a live search?

What do you mean by ‘live search’? Search-as-you-type is no problem, but
this hasn’t to do much with indexing…

Cheers,
Jens


Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
[email protected] | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs