In my rails application i a have a job model
belongs_to :company
belongs_to :organization
and i want to drop-down a name list of all company name and organization name in the same field so I'm wondering if this is possible actually I was just using company name before i have added the organization, I have this code in my job form
<%= f.text_field :company_name, data: {autocomplete_source: Company.order(:name).map(&:name) },required: true %>
and this in my job model
def company_name
company.try(:name)
end
def company_name=(name)
self.company = Company.where(name: name).first_or_create
end