Reputation: 554
I'm trying to check if a value of an attribute is included in an array. Like that:
@teste = []
@vacancies_interns.each do |vacancy_intern|
@teste << vacancy_intern.id
end
@hr_curriculum_interns = HrCurriculumIntern.where(@teste.include?(:id) == true)
The output of the variable @teste, as an example, is: [5, 6, 8, 10, 12, 15]
I am listing the variable @ hr_curriculum_interns on a table, and even with the condition, is listing all table rows.
Sorry for English :P
Upvotes: 1
Views: 44
Reputation: 44685
It as simple as:
@hr_curriculum_interns = HrCurriculumIntern.where(id: @teste)
Upvotes: 2