class RuboCop::Cop::Rails::ArelStar
# good
MyTable.arel_table[“*”]
# bad
@example
to expanding the column list as one would likely expect.
database to look for a column named `*`
(or ‘“*”`) as opposed
quoted asterisk (e.g. `my_model`.`*`
). This causes the
Using `arel_table` causes the outputted string to be a literal
This cop prevents usage of `“*”` on an Arel::Table column reference.
def on_send(node)
def on_send(node) return unless (star = star_bracket?(node)) add_offense(star) do |corrector| corrector.replace(star.loc.expression, 'Arel.star') end end