Skip to content

Files

Latest commit

 

History

History
26 lines (17 loc) · 641 Bytes

Rails-ArelStar.md

File metadata and controls

26 lines (17 loc) · 641 Bytes

Pattern: Missing use of Arel.star instead of "*"

Issue: -

Description

Prevents usage of "*" on an Arel::Table column reference.

Using arel_table["*"] causes the outputted string to be a literal quoted asterisk (e.g. my_model.*). This causes the database to look for a column named * (or "*") as opposed to expanding the column list as one would likely expect.

Examples

# bad
MyTable.arel_table["*"]

# good
MyTable.arel_table[Arel.star]

Further Reading