Tim Scott
Tim Scott

Reputation: 15205

Superclass mismatch - for model

I get this error:

app/models/result/login_failed.rb:2:in `<module:Result>': superclass mismatch for class LoginFailed (TypeError)

It seems that this app/models/result/login_failed.rb:

module Result
  class LoginFailed < Failed

Is somehow colliding with this lib/services/providers/errors/login_failed.rb:

module Services
  module Providers
    module Errors
      class LoginFailed < StandardError

I tried changing the model to this, but get the same error.

class Result::LoginFailed < Failed

If I change the model name, the error goes away. I don't understand why -- given the namespacing -- the names are colliding. How can I prevent collision without renaming the model to something less meaningful?

Upvotes: 0

Views: 71

Answers (1)

Tim Scott
Tim Scott

Reputation: 15205

The problem was not proximate to the error. A file app/models/result/some_other_result.rb::

module Result
  class LoginFailed < Failed

I was refactoring a little to fast. Some days I miss the compiler.

Upvotes: 1

Related Questions