Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solargraph recommended approach for concerns included in files that override a function? #666

Open
lukecivantos opened this issue Jun 9, 2023 · 0 comments

Comments

@lukecivantos
Copy link

So the situation I'm running into is I have an interaction (using ActiveInteraction which overrides hash):

class ExampleInteraction < ActiveInteraction::Base
  include ExampleConcern
end

and that interaction includes a Rails concern:

module ExampleConcern
  extend ActiveSupport::Concern
  
  included do
    hash :some_hash, default: {}, strip: false
  end
end

And I'm subsequently getting an error on the hash: Too many arguments to Object#hash from Typecheck – it looks at Object#hash instead of ActiveInteraction#hash

This behavior makes sense as it can't really know that the concern is going to be included in a file that overrides hash, but I'm wondering if there's any recommended workaround to avoid this error as this is a fairly common pattern in our codebase

I believe I can add something to definitions.rb to solve, but I haven't been able to figure it out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant