Habtm and ferret

Hello,

I’ve been working on a specific project for longer than I like to
think about. At some point, I had ferret working in such a way that it
would search fields in the HABTM relationship. Now, though, it only
searches fields in the specific model where the search is located. The
application is structured like this:

Models:

providers
procedures
types
destinations

provider is where the search in question is located. Thus, it is at
http://localhost:3000/provider/search/. A provider
has_and_belongs_to_many procedures, types, and destinations. Thus,
when I search at the above URL, I want my search to take values that
correspond to those models, as well as the provider model.

provider.rb:

  1. acts_as_ferret :additional_fields => [
  2.                                    :procedure_name,
    
  3.                                    :type_name,
    
  4.                                    :type_field,
    
  5.                                    :destination_name
    
  6.                                    ]
    
  7. has_and_belongs_to_many :types, :join_table =>
    “types_providers”
  8. has_and_belongs_to_many :procedures, :join_table =>
    “procedures_providers”
  9. has_and_belongs_to_many :destinations, :join_table =>
    “destinations_providers”
  10. def procedure_name
  11. return "#{self.procedure.name}"
    
  12. end
  13. def type_name
  14. return "#{self.type.name}"
    
  15. end
  16. def type_field
  17. return "#{self.type.field}"
    
  18. end
  19. def destination_name
  20. return "#{self.destination.name}"
    
  21. end

Thus, I defined the additional fields which I would like ferret to
index. It was doing this perfectly until recently, and I have tried
rebuilding the indexes of the above models and tried various other
small edits, but nothing has helped thus far.

Any ideas would be most appreciated. Thanks.
Jon

bump.