class User
scope :active, -> { where(active: true) }
end
Running rubocop I get the following warning:
Parenthesize the param
-> { where(active: true) }
to make sure that the block will be associated with the->
method call.
I have no slightest clue, what my scope
definition has to do with this warning. Do you?
How do I fix the warning except for turning the check off because it makes no sense at the moment?
It wants you to do this:
scope :active, (-> { where(active: true) })
Better to turn off the warning :)
This stabby lambda syntax is perfectly fine. Maybe you have old rubocop version?
Update: fixed in 0.49.0.
gem update rubocop
worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With