Suppose I have three models:
class City < ActiveRecord::Base
has_many :events
has_many :contacts
end
class Event < ActiveRecord::Base
belongs_to :city
has_many :contacts
end
class Contact < ActiveRecord::Base
belongs_to :city
end
and while editing the details for an Event I want to add contacts for that event. I use an autocomplete field but I only want the autocomplete list to show Contacts from the city the Event is happening in; i.e. If an event is happening in New York I only want to see contacts from New York and no where else.
Is this possible with rails4-autocomplete? Any suggestions?