I'm using Sunspot Solr to search events and each event has a group_id that refers to a Group object (multiple events can have the same group). I want to find the right events if the user searches the group name.
Attempted solution in the searchable block
string :events_group_name do
group.map(&:name)
end
Error
SQLite3::SQLException: no such column: groups.event_id: SELECT "groups".* FROM "groups" WHERE "groups"."event_id" = 3 LIMIT 1
Problem is that there is no event_id in Group, so how can I get this to work? The workaround is to save the group name as a column in the Event object, but surely there's a better way. Thank you!