I am using Active Admin with metasearch. I have a habtm relationship but the join table is not the default one. I have
class Person < ActiveRecord::Base
has_and_belongs_to_many :events, :join_table => 'events_staff'
end
class Event < ActiveRecord::Base
has_and_belongs_to_many :staff, :class_name => 'Person', :join_table => 'events_staff'
end
When I use active admin, I wanted something like:
ActiveAdmin.register Person do
filter :events, :join_table => 'events_staff'
end
Renaming the models is not an option. How do I do this?
Ok this question: How do I do multiple has_and_belongs_to_many associations between the same two classes? gave me a strategy to rename my relation in the Person model. So now I have:
class Person < ActiveRecord::Base
has_and_belongs_to_many :staffed_events, :join_table => 'events_staff', :class_name => 'Event'
end
And my filter is filter :staffed_events