Hello there,
I have a problem when searching on an objects filtered objects using
thinking_sphinx. I get the following error message: "RuntimeError
(Missing Attribute for Foreign Key map_id)" when using the following
method:
@map = Map.find(:first, :conditions => {:id => params[:map_id]})
@entries = @map.entries.search live_search_string
The relevant info in the models I have are the following:
class Map < ActiveRecord::Base
has_many :entries, :through=>:mappings
end
class Entry < ActiveRecord::Base
has_many :mindmaps, :through=>:mappings
end
My index is defined in the Entry class like so:
define_index do
indexes title
indexes content
has user_id
end
So I have tried to add this field like the user_id but with no result.
Something tells me I have to do something fancy to have the model
understand this many-to-many relation? I even tried specifying a
custom search method like someone on stackoverflow mentioned, but it
just found all entries and did not filter on the current map I'm
searching on. Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" 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/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---