Rubocop 抛出此错误:
Lint/Syntax: unexpected token tCOMMA
(Using Ruby 3.2 parser; configure using TargetRubyVersion parameter, under AllCops)
render (:new, status: :unprocessable_entity)
代码如下:
def create
@company = current_user.companies.build(company_params)
if @company.save
redirect_to(company_url(@company), { notice: "Company was successfully updated." })
else
render (:new, status: :unprocessable_entity)
end
end
即使改回
render :new, status: :unprocessable_entity
,它要求我改成render (:new, status: :unprocessable_entity)
,我已经尝试了一切,但仍然没有运气
任何帮助将不胜感激,如果您想进一步了解,我可以邀请您访问我的 GitHub
这不是 RuboCop 问题,使用
ruby -w
运行它会报告它无效。
问题是
render
后面的空格。删除它,它就有效。