g.column name: '#', attribute: 'id', assoc: [:register] do |invoice|
invoice.register.id
end
g.column name: 'Student', attribute: 'name', assoc: [:register, :student] do |invoice|
invoice.register.student.name
end
When searching by student.name, it raises the following error:
PG::UndefinedTable: ERROR: missing input to table "students" at clause FROM
SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "invoices" INNER JOIN "registers" ON "registers"."id" = "invoices"."register_id" AND "registers"."company_id" = $1 WHERE (registers.status = 1 AND invoices.status = 1) AND "invoices"."company_id" = $2 AND ( students.name ILIKE '%d%') LIMIT 20 OFFSET 0) subquery_for_count
But, switching the columns position, the error gone:
g.column name: 'Student', attribute: 'name', assoc: [:register, :student] do |invoice|
invoice.register.student.name
end
g.column name: '#', attribute: 'id', assoc: [:register] do |invoice|
invoice.register.id
end
Consider the sequence of this columns:
When searching by student.name, it raises the following error:
PG::UndefinedTable: ERROR: missing input to table "students" at clause FROM
But, switching the columns position, the error gone: