Or you add a method to your employee that you can call, for example:
class Employee < ActiveRecord::Base
...
def entity_name
self.entity.name
end
end
and then:
select_tag "employee_compensation_benefits_selection", options_from_collection_for_select(@employees, "id", "entity_name", "1")
or you can use lambda instead of adding a method:
select_tag "employee_compensation_benefits_selection", options_from_collection_for_select(@employees, "id", lambda { |employee| employee.entity.name }, "1")
source
share