You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When I use a custom Error class in a helper method using a variable, it gets flagged by Rails/HelperInstanceVariable.
Describe the solution you'd like
I'd like Rails/HelperInstanceVariable to accept assignment to instance variables for use with a custom Error class:
moduleSomeHelperclassInvalidSomethingError < StandardErrorattr_reader:foodefinitialize(messsage=nil,foo: nil)super(message)@foo=fooenddefmessageklass=foo.is_a?(Class) ? foo : foo.class"#{klass} is not supported!"endend# def helper methods that use InvalidSomethingErrorend
I'm wondering if it makes sense for exception classes to be placed in helpers where view helper is placed. Probably it will be placed in a place such as models or controllers.
Depends, custom error classes are often, defined where they belong, eg in a service class or other that is not a model or controller. I have a use case where I only need this error inside helpers but I won't insist 😉
Is your feature request related to a problem? Please describe.
When I use a custom Error class in a helper method using a variable, it gets flagged by Rails/HelperInstanceVariable.
Describe the solution you'd like
I'd like Rails/HelperInstanceVariable to accept assignment to instance variables for use with a custom Error class:
Similar to: #311
The text was updated successfully, but these errors were encountered: