In attempting to search child models (returning the parent object)
using part of the
"# Descend child elements" script
at
http://duncan.beevers.net/?s=all_fields
I get a "no method" error for "all_fields". Does anyone know
why this
could be or where in fact the method comes from. If it works its a
good solution unless anyone knows of any another way of searching
child models while still returning the parent object.
His script is:
# Descend child elements
self.class.reflect_on_all_associations.collect { |association|
self.send(association.instance_values["name"]).collect { |
child|
child.to_doc.all_fields.collect { |field|
doc << field
} if child.class.respond_to?("acts_as_ferret")
}
}
To use: extend the acts_as_ferret to_doc method by copying it into the
parent model and add the above code onto the end of it before the
return of doc.
Incidentally I use the code below instead (hard coding a child model)
but still have the same problem.
self.products.each do |product|
product.to_doc.all_fields.collect { |field| doc <<
field}
end
I appreciate any help....my deadline looms!
Eddie
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---