Hi!

On Thu, Jul 13, 2006 at 07:53:36PM +0200, Guest wrote:
> 
> Wait so, now I added acts_as_ferret in the menu_item model, and it looks 
> as it's it's being indexed in the log, but I still don't get the 
> results.

calling acts_as_ferret in the MenuItem class will create a separate
index for MenuItems, this is probably not what you want.

The problem is, that ferret only can index what your menu_item_name 
method delivers when the object is saved. If you save the object before
creating the menus and menu_items, there's nothing to index.

You could try to create the menus and menu_items first, then add them to
the object to be indexed and then call save. 

Or just call save another time after you created the menus.

btw, 'menuitems' sounds like it is a collection of menuitems, so what 
should 'menuitems.name' deliver ? Maybe you want something like

menuitems.inject('') { |value, item| value << " #{item.name}" }

concatenating the names of all menuitems to one string which then would
be indexed ? The same for 'menus', sounds like a has_many relationship, too.


I'm sure we'll get this right somehow ;-)

Jens

> Hmm...
> 
> Guest wrote:
> > 
> > 
> > OK, when I create the top level item, it indexes the fields, but since 
> > I'm creating the menus and menu_items separately it doesn't look like 
> > those are getting indexed according to the log. Do I have to set 
> > something else up?
> > 
> > Thanks Jens!
> > 
> > Jens Kraemer wrote:
> >> On Thu, Jul 13, 2006 at 04:59:02PM +0200, Guest wrote:
> >>> 
> >>> Hmm. I tried doing it with a few levels of nesting like:
> >>> 
> >>> acts_as_ferret :fields => { :menu_item_name, 'city', 'state', 'zip' }
> >>> 
> >>> def menu_item_name
> >>>  menus.menu_categories.menu_items.name
> >>> end
> >>> 
> >>> And I don't get any results.
> >> 
> >> that can have many reasons ;-)
> >> Basically, what you do in the method is irrelevant to ferret, it just
> >> indexes what is returned by the method.
> >> 
> >> You should see what fields acts_as_ferret adds to the index
> >> in your development log when you save a record.
> >> please check there if it adds what you want.
> >> 
> >> Jens
> >> 
> >> --
> >> webit! Gesellschaft f�r neue Medien mbH          www.webit.de
> >> Dipl.-Wirtschaftsingenieur Jens Kr�mer       [EMAIL PROTECTED]
> >> Schnorrstra�e 76                         Tel +49 351 46766  0
> >> D-01069 Dresden                          Fax +49 351 46766 66
> 
> 
> -- 
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ferret-talk mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/ferret-talk
-- 
webit! Gesellschaft für neue Medien mbH          www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer       [EMAIL PROTECTED]
Schnorrstraße 76                         Tel +49 351 46766  0
D-01069 Dresden                          Fax +49 351 46766 66
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to