DEV: stop logging warning when overriding open scope

ActiveRecord defines automatic scopes for enums, the Poll model defines
an enum for `{open: 1}` this mean Rails wants the scope `Poll.all.open`
to work which in turn means it has to override `open` which is defined
privately.

Rails feature req exists for: https://github.com/rails/rails/issues/34599
which will allow us to define enums without scopes which would resolve this
a lot more cleaner.
This commit is contained in:
Sam 2018-12-03 13:52:09 +11:00
parent f555582eb2
commit 12f5889c85
1 changed files with 9 additions and 1 deletions

View File

@ -50,7 +50,15 @@ if Rails.env.production?
# we handle this cleanly in the message bus middleware
# no point logging to logster
/RateLimiter::LimitExceeded.*/m
/RateLimiter::LimitExceeded.*/m,
# see https://github.com/rails/rails/issues/34599
# Poll defines an enum with the value `open` ActiveRecord then attempts
# AR then warns cause #open is being redefined, it is already defined
# privately in Kernel per: http://ruby-doc.org/core-2.5.3/Kernel.html#method-i-open
# Once the rails issue is fixed we can stop this error suppression and stop defining
# scopes for the enums
/^Creating scope :open\. Overwriting existing method Poll\.open\./,
]
end